Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub Tag MajorGitHub Tag MinorGitHub Release VersionGitHub Dist SizeWorkflow ReleaseWorkflow TestWorkflow LintQuality Gate StatusGitHub Last CommitCodeberg Last CommitGitHub Repo SizeGitHub Top LanguageGitHub ContributorsGitHub DiscussionsGitHub ForksGitHub Repo StarsGitHub Org StarsDiscordKo-fi

Docker SSH Context Action

Set up a Remote Docker Context over SSH using Password or Keyfile Authentication.
This allows all subsequent docker commands to run on the remote host (context).

steps:
- name: 'Docker Context'uses: cssnr/docker-context-action@v1with:
host: ${{ secrets.DOCKER_HOST }}user: ${{ secrets.DOCKER_USER }}port: 22# 22 is the default value - optionalpass: ${{ secrets.DOCKER_PASS }} # or ssh_key - optionalssh_key: ${{ secrets.DOCKER_SSH_KEY }} # or pass - optional
- name: 'Inspect Docker'run: | docker context ls docker context inspect docker info docker ps

Make sure to review the Inputs.

Stack Deploy: If you only need to deploy a swarm or compose stack use: cssnr/stack-deploy-action
Portainer Users: You can deploy directly to Portainer with: cssnr/portainer-stack-deploy-action

Features

Don't see your feature here? Please help by submitting a Feature Request.

Inputs

Input NameDefault ValueDescription of Input
hostRequiredSSH Hostname or IP
userRequiredSSH Username
port22SSH Port
passor ssh_keySSH Password
ssh_keyor passSSH Key File
registry_user-Registry Username
registry_pass-Registry Password
registry_hostdocker.ioRegistry Host
tokengithub.tokenPersonal Access Token

With all inputs (not all required).

- name: 'Docker Context'uses: cssnr/docker-context-action@v1with:
host: ${{ secrets.DOCKER_HOST }}user: ${{ secrets.DOCKER_USER }}port: 22# 22 is default, you can remove or change thispass: ${{ secrets.DOCKER_PASS }} # not needed with ssh_keyssh_key: ${{ secrets.DOCKER_SSH_KEY }} # not needed with passregistry_user: ${{ vars.GHCR_USER }}registry_pass: ${{ secrets.GHCR_PASS }}registry_host: 'ghcr.io'

Make sure to check out the Examples.


host

The hostname or IP address of the remote docker server.

If your hostname is behind a proxy like Cloudflare you will need to use the IP address.

pass/ssh_key

Required to set up the SSH the connection. Provide a pass or ssh_key but not both.

If this was done in a previous step, omit these values to skip this step.

registry_user/registry_pass

Only set these to run docker login.

This can also be run manually in another step.

registry_host

To run docker login on another registry. Requires both registry_user/registry_pass.

Example: ghcr.io.

token

The ${{ github.token }} / {{ secrets.GITHUB_TOKEN }} is automatically passed, there is no need to manually pass these!

This is only used to download the bin scripts from the GitHub API. You can pass a PAT from your secrets if the default token does not work.

Examples

Example workflow.

steps:
- name: 'Docker Context'uses: cssnr/docker-context-action@v1with:
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

For more examples, you can check out other projects using this action:
https://github.com/cssnr/docker-context-action/network/dependents

Tags

The following rolling tags are maintained.

Version TagRollingBugsFeat.NameTargetExample
GitHub Tag MajorMajorvN.x.xvN
GitHub Tag MinorMinorvN.N.xvN.N
GitHub ReleaseMicrovN.N.NvN.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.

Support

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.

Contributing

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.

Ko-fi

Actions Tools

Additionally, you can support other GitHub Actions I have published:

❔ Unpublished Actions

These actions are not published on the Marketplace, but may be useful.


📝 Template Actions

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/

About

Set up a Docker Remote Context over SSH using Password or Keyfile Authentication

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages