Features β
Deploy a Docker stack or compose file, to a remote host over SSH, using a Remote Context. This deploys the stack from the current workspace without copying files.
- Deploy to Docker Swarm or Compose.
- Deploy over SSH using keyfile or password.
- Deploy from the current working directory.
- Deploy from a private registry with credentials.
- Job Summary with deployment output, including errors.
- Supports multiple compose files and stack deployments.
- Allows setting custom arguments for the deployment command.
- To view all features see the Inputs Documentation.
You can get started here or view workflow examples.
Request a Feature
If you need more options, please open a feature request
Remote Context β
This action uses a remote context to deploy the stack on the remote host, from the current environment.
docker context create remote --docker "host=ssh://user@host:port"
docker context use remoteAfter this all the subsequent docker commands, such as stack deploy and compose up are executed on the remote context (host).
This allows you to run any steps to prepare your stack for deployment, in the workflow steps directly, without needing to copy any files.
View workflow steps example
steps:
- name: 'Checkout'
uses: actions/checkout@v5
# Add Steps to Prepare Your Stack File or Environment...
- name: 'Stack Deploy'
uses: cssnr/stack-deploy-action@v1
with:
# inputs excludedIf you need to run multiple docker commands check out the new Docker Context Action.
Set up a docker context in the current workflow to run docker commands in subsequent steps.
View Context Action Example
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'
runs: docker stack deploy -c docker-compose.yaml --detach=false stack-nameJob Summary β
Unless disabled, a Job Summary is generated to capture the command, output and errors.
π‘ Click on the heading to expand/collapse the item.
Successful Job Summary βοΈ
π Swarm Stack test_stack-deploy Successfully Deployed.
docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deployResults
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 convergedFailure Job Summary β
β Swarm Stack test_stack-deploy Failed to Deploy!
docker stack deploy -c docker-compose.yaml --detach=false --resolve-image=changed test_stack-deployErrors
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 existsYou can view an actual workflow run from the Test job on GitHub (requires login).
Rolling Tags β
The following rolling tags are maintained to improve stability across updates.
| 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.
Tags Security Notice β
As shown above, tags are mutable; however, commit hashes are not. Therefore, if security is your top priority, you should pin your actions to a specific commit hash.
Β
Action Comparison
There is also an Action Comparison on the Resources guide.
