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.
See action.yml for more detailed information.
host- Docker daemon hostuser- SSH userkey- Content of SSH private key
Optional:
port- SSH port, default to22key_path- Path to the SSH private key, default to/home/runner/.ssh/id_rsaset_docker_host_env- Whether theDOCKER_HOSTenv var should be updated, default totrue
docker-host- The value ofDOCKER_HOSTin the format ofssh://<user>@<host>:<port>
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 psAlternatively, 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 }}