Skip to content

Github Action to setup a connection to remote Docker daemon via SSH

Notifications You must be signed in to change notification settings

pcjun97/action-setup-docker-host-ssh

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

Docker over SSH

Setup the connection to remote Docker daemon via SSH. Adds private key, known hosts and ssh configuration file. Optionally setups the DOCKER_HOST environment variable.

Input variables

See action.yml for more detailed information.

  • host - Docker daemon host
  • user - SSH user
  • key - Content of SSH private key

Optional:

  • port - SSH port, default to 22
  • key_path - Path to the SSH private key, default to /home/runner/.ssh/id_rsa
  • set_docker_host_env - Whether the DOCKER_HOST env var should be updated, default to true

Output variables

  • docker-host - The value of DOCKER_HOST in the format of ssh://<user>@<host>:<port>

Usage

Default - Configure env var DOCKER_HOST in every subsequent steps to point to the Docker daemon host.

- uses: pcjun97/action-setup-docker-host-ssh@v1
  with:
    host: ${{ secrets.SSH_HOST }}
    port: ${{ secrets.SSH_PORT }}
    user: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}

- run: |
  docker ps

Alternatively, set up the environment variable with per step basis.

- uses: pcjun97/action-setup-docker-host-ssh@v1
  id: docker-ssh
  with:
    host: ${{ secrets.SSH_HOST }}
    port: ${{ secrets.SSH_PORT }}
    user: ${{ secrets.SSH_USER }}
    key: ${{ secrets.SSH_KEY }}
    set_docker_host_env: 'false'

- run: |
    docker ps
  env:
    DOCKER_HOST: ${{ steps.docker-ssh.outputs.docker-host }}

About

Github Action to setup a connection to remote Docker daemon via SSH

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published