
Easily Deploy a Docker Swarm or Compose Stack to a Remote Docker Host over SSH, with Keyfile or Password Authentication
Repo cssnr/stack-deploy-action, read from GitHub 18 h ago. cssnr has not joined Take My Repo.
cssnr/stack-deploy-action is a public repo on GitHub by cssnr. Easily Deploy a Docker Swarm or Compose Stack to a Remote Docker Host over SSH, with Keyfile or Password Authentication. It declares the GPL-3.0 license on GitHub. It is written mainly in Shell, has 43 stars and last changed on 2025-12-14. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Easily Deploy a Docker Swarm or Compose Stack, from a compose file, to a remote Docker host over SSH, with keyfile or password authentication.
Deploy directly from the actions working directory without copying any files using a remote Docker context. This allows you to easily prepare your environment for deployment using normal steps.
Supports many features including authenticating against a private registry, deploying multiple stack files, setting custom arguments, and much more.
[!TIP]
▶️ View the Getting Started Guide on the website.
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name' # set to your stack name
file: 'docker-compose.yaml' # set to your compose file
host: ${{ secrets.DOCKER_HOST }}
user: ${{ secrets.DOCKER_USER }}
port: 22 # 22 is default, you can remove or change this
pass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_key
ssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with pass
mode: swarm # if not using swarm set to: compose
Make sure to review the Inputs, available Tags and additional Examples.
New Docker Context Action to set up a docker context and run remote docker commands in workflow steps.
steps:
- name: 'Docker Context'
uses: cssnr/docker-context-action@v1
with:
host: ${{ secrets.DOCKER_HOST }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
- name: 'Stack Deploy'
run: docker stack deploy -c docker-compose.yaml --detach=false stack-name
Portainer Users: You can deploy directly to Portainer with: cssnr/portainer-stack-deploy-action
Don't see your feature here? Please help by submitting a Feature Request.
You can also view an Action Comparison of 50+ actions published on the marketplace.
[!IMPORTANT]
View the Inputs Documentation for comprehensive, up-to-date documentation.
| Input Name | Default Value | Short Description of the Input Value |
|---|---|---|
name |
Required | Docker Stack/Project Name ⤵️ |
file |
docker-compose.yaml |
Docker Stack/Compose File(s) (supports multiple) ⤵️ |
mode¹ |
swarm |
Deploy Mode [swarm, compose] ⤵️ |
args¹ |
--remove-orphans --force-recreate |
Additional Compose Arguments ⤵️ |
host |
Required | Remote Docker Hostname or IP ⤵️ |
port |
22 |
Remote Docker Port port |
user |
Required | Remote Docker Username user |
pass |
or ssh_key | Remote Docker Password ⤵️ |
ssh_key |
or pass | Remote SSH Key File ⤵️ |
disable_keyscan |
false |
Disable SSH Keyscan ssh-keyscan ⤵️ |
env_file |
- | Docker Environment File ⤵️ |
detach² |
true |
Detach Flag, false, to disable ⤵️ |
prune² |
false |
Prune Flag, true, to enable prune |
resolve_image² |
always |
Resolve [always, changed, never] ⤵️ |
registry_auth² |
false |
Enable Registry Authentication ⤵️ |
registry_host |
- | Registry Authentication Host ⤵️ |
registry_user |
- | Registry Authentication Username ⤵️ |
registry_pass |
- | Registry Authentication Password ⤵️ |
summary |
true |
Add Job Summary ⤵️ |
¹ Compose Only, view the Docs.
² Swarm Only, view the Docs.
* More details below...
Note: "${STACK_FILES[@]}" is an array of file paths with the appropriate flag prepended:
-c file1.yaml -c file2.yaml for each file-f file1.yaml -f file2.yaml for each fileFiles are processed in the order provided and merged, with later files overriding earlier ones.
If you need more control over the deployment command or have a complex deployment, see the Docker Context Action.
Stack name for Swarm and project name for Compose.
Stack file or Compose file(s). Multiple files can be provided, space-separated, and a -c flag (for swarm) or -f flag (for compose) will be prepended to each file.
Examples:
docker-compose.yamlbase.yaml production.yamlNote: Files are merged in order, with later files overriding earlier ones.
Compose only. Set this to compose to use compose up instead of stack deploy for non-swarm hosts.
Compose only. Compose arguments to pass to the compose up command. Only used for mode: compose deployments.
The detach flag defaults to false for compose. With no args the default is --remove-orphans --force-recreate.
Use an empty string to override. For more details, see the compose
docs.
The hostname or IP address of the remote docker server to deploy too. If your hostname is behind a proxy like Cloudflare you will need to use the IP address.
You must provide either a pass or ssh_key, not both.
This will disable the ssh-keyscan command. Advanced use only.
Variables in this file are exported before running stack deploy.
To use a docker env_file specify it in your compose file and make it available in a previous step.
If you need compose file templating this can also be done in a previous step.
If using mode: compose you can also add the compose_arg: --env-file stringArray.
Swarm only. Set this to false to not exit immediately and wait for the services to converge.
This will generate extra output in the logs and is useful for debugging deployments.
Defaults to false in mode: compose.
Swarm only. When the default always is used, this argument is omitted.
Swarm only. Set to true to deploy with --with-registry-auth.
To run docker login on another registry. Example: ghcr.io.
Required to run docker login before stack deploy.
Write a Summary for the job. To disable this set to false.
To view a workflow run, click on a recent Test job (requires login).
🚀 Swarm Stack test_stack-deploy Successfully Deployed.
docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deploy
Updating service test_stack-deploy_alpine (id: tdk8v42m0rvp9hz4rbfrtszb6)
1/1:
overall progress: 0 out of 1 tasks
overall progress: 1 out of 1 tasks
verify: Waiting 5 seconds to verify that tasks are stable...
verify: Waiting 4 seconds to verify that tasks are stable...
verify: Waiting 3 seconds to verify that tasks are stable...
verify: Waiting 2 seconds to verify that tasks are stable...
verify: Waiting 1 seconds to verify that tasks are stable...
verify: Service tdk8v42m0rvp9hz4rbfrtszb6 converged
⛔ Swarm Stack test_stack-deploy Failed to Deploy!
docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deploy
Creating network test_stack-deploy_default
failed to create network test_stack-deploy_default: Error response from daemon: network with name test_stack-deploy_default already exists
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name' # set to your stack name
file: 'docker-compose.yaml' # set to your compose file
host: ${{ secrets.DOCKER_HOST }}
user: ${{ secrets.DOCKER_USER }}
port: 22 # 22 is default, you can remove or change this
pass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_key
ssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with pass
mode: swarm # if not using swarm set to: compose
Additional Examples are available on the website.
💡 Click on an example heading to expand or collapse the example.
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
detach: false
prune: true
resolve_image: 'changed'
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_key
ssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with pass
env_file: 'stack.env'
detach: true
prune: false
resolve_image: 'always'
registry_auth: true # not needed with registry_pass/registry_user
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
summary: true
- name: 'Compose Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
mode: compose
- name: 'Compose Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
mode: compose
args: --remove-orphans --force-recreate
Note: these are the default arguments. If you use args this will override the default arguments unless they are included.
You can disable them by passing an empty string. For more details, see the compose up docs.
Deploy with a base configuration and environment-specific overrides:
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'my-stack'
file: 'docker-compose.base.yaml docker-compose.production.yaml'
host: ${{ secrets.DOCKER_HOST }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
This will merge the files in order, with docker-compose.production.yaml overriding values from docker-compose.base.yaml.
- name: 'Compose Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
mode: compose
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_key
ssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with pass
env_file: 'stack.env'
registry_host: 'ghcr.io'
registry_user: ${{ vars.GHCR_USER }}
registry_pass: ${{ secrets.GHCR_PASS }}
mode: compose
args: --remove-orphans --force-recreate
summary: true
name: 'Stack Deploy Action'
on:
push:
jobs:
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: 'Checkout'
uses: actions/checkout@v5
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
pass: ${{ secrets.DOCKER_PASS }}
name: 'Stack Deploy Action'
on:
workflow_dispatch:
inputs:
tags:
description: 'Tags: comma,separated'
required: true
default: 'latest'
env:
REGISTRY: 'ghcr.io'
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
packages: write
steps:
- name: 'Checkout'
uses: actions/checkout@v5
- name: 'Setup Buildx'
uses: docker/setup-buildx-action@v3
with:
platforms: 'linux/amd64,linux/arm64'
- name: 'Docker Login'
uses: docker/login-action@v3
with:
registry: $${{ env.REGISTRY }}
username: ${{ secrets.GHCR_USER }}
password: ${{ secrets.GHCR_PASS }}
- name: 'Generate Tags'
id: tags
uses: cssnr/docker-tags-action@v1
with:
images: $${{ env.REGISTRY }}/${{ github.repository }}
tags: ${{ inputs.tags }}
- name: 'Build and Push'
uses: docker/build-push-action@v6
with:
context: .
platforms: 'linux/amd64,linux/arm64'
push: true
tags: ${{ steps.tags.outputs.tags }}
labels: ${{ steps.tags.outputs.labels }}
deploy:
name: 'Deploy'
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [build]
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
name: 'stack-name'
file: 'docker-compose-swarm.yaml'
host: ${{ secrets.DOCKER_HOST }}
port: ${{ secrets.DOCKER_PORT }}
user: ${{ secrets.DOCKER_USER }}
ssh_key: ${{ secrets.DOCKER_SSH_KEY }}
cleanup:
name: 'Cleanup'
runs-on: ubuntu-latest
timeout-minutes: 5
needs: deploy
permissions:
contents: read
packages: write
steps:
- name: 'Purge Cache'
uses: cssnr/cloudflare-purge-cache-action@v2
with:
token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
zones: cssnr.com
For more examples, you can check out other projects using this action:
https://github.com/cssnr/stack-deploy-action/network/dependents
The following rolling tags are maintained.
| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | Major | vN.x.x |
vN |
|
| ✅ | ✅ | ❌ | Minor | vN.N.x |
vN.N |
|
| ❌ | ❌ | ❌ | Micro | vN.N.N |
vN.N.N |
You can view the release notes for each version on the releases page.
The Major tag is recommended. It is the most up-to-date and always backwards compatible. Breaking changes would result in a Major version bump. At a minimum you should use a Minor tag.
For general help or to request a feature see:
If you are experiencing an issue/bug or getting unexpected results you can:
For more information, see the CSSNR SUPPORT.md.
If you would like to submit a PR, please review the CONTRIBUTING.md.
Please consider making a donation to support the development of this project and additional open source projects.
Additionally, you can support other GitHub Actions I have published:
These actions are not published on the Marketplace, but may be useful.
These are basic action templates that I use for creating new actions.
Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.
For a full list of current projects visit: https://cssnr.github.io/
cssnr/stack-deploy-action is a public repo on GitHub by cssnr. Easily Deploy a Docker Swarm or Compose Stack to a Remote Docker Host over SSH, with Keyfile or Password Authentication.
It declares the GPL-3.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2025-12-14. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
Full-stack web application template with FastAPI, React, SQLModel, PostgreSQL, Vite, Tailwind CSS, shadcn/ui, FastAPI Cloud, and Docker Compose.
Open source alternative to AWS. Elastic compute, block storage (non replicated), firewall and load balancer, managed Postgres, K8s, AI inference, and IAM services.
Practical patterns, starters & CLI tools for loop engineering with AI coding agents. Design systems that prompt and orchestrate agents (inspired by Addy Osmani and Boris Cherny). Includes loop-audit, loop-init, loop-cost.
Web Extension to extract, parse, and open links with optional filters.
Modern Chrome Web Extension and Firefox Browser Addon for Automatic Basic HTTP Authentication with many Options and Features.

Deploy or Update a Portainer Swarm Stack or Standalone Docker Compose Stack Easily from GitHub Actions with Custom Options

Web Extension to Open Links in New Tabs for Specified Domains or Temporarily on Any Tab.

Remote Wallpaper Android Application. Set wallpaper from remote URLs at a defined interval. Supports any link that redirects to an image.

This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/cssnr/stack-deploy-actionTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.