appleboy / scp-action

GitHub Action that copy files and artifacts via SSH.
https://github.com/marketplace/actions/scp-command-to-transfer-files
MIT License
1.14k stars 134 forks source link

Docker-in-docker support #97

Open seandve opened 1 year ago

seandve commented 1 year ago

I'm running a github-runner in a docker container. That container runs actions containing the scp-action. This means that when the scp-action tries to start its own container, the volume bindings: _-v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/docker/actions-runner/_work/_temp/_***_home":"/***/home" -v "/home/docker/actions-runner/_work/_temp/_***_workflow":"/***/workflow" -v "/home/docker/actions-runner/_work/_temp/_runner_file_commands":"/***/file_commands" -v "/home/docker/actions-runner/_work/my-application/my-application":"/***/workspace"_ are mapping to the directories in my github runner container. However, since it is sharing docker with the host (docker.sock) the mapping will be made to the folder on the docker host and not the github runner container. This results in no files being present in the scp-action container and "tar is empty".

Anyone have some tips on how to get around this issue? I can bind the files of my github runner on the host, but the volumne mapping used by scp-action cannot be changed and will always map the files on on the runner /home/docker/actions-runner/_work etc.

seandve commented 1 year ago

Ok, so if anyone hits this, the only solution I have found is the not-so-good-workaround to create the /home/docker/actions-runner/_work/ folder on the host and map that to the github runner container. When it later starts the scp-action and tries to bind that same folder, the files exist on the host.

This will probably prevent me from running multiple github runners since that folder structure will be the same for all runners. Command added when starting the github runner: -v /home/docker/actions-runner/_work/:/home/docker/actions-runner/_work/