Accessing runner files/credentials from Docker action

I’m trying to develop a Docker action (https://github.com/dfreilich/pack-action), which would, in some cases, require Docker authentication. I’m trying to use it together with the Docker login action, but I seem to be unable to, because the login action writes it to the /home/runner/.docker/config.json, while as a Docker container action, we are only able to access /github/home/.docker/config.json. As such, whenever I log in outside of the scope of my action (even if I do it explicitly, running docker login...), those credentials aren’t available to my action.

Is there any way for me, as the developer, to access the docker config written to the /home/runner directory? Alternatively, is there any other way I can take advantage of the docker login action/a straight docker login from my action?

Thanks for your feedback.
By checking your log, we can find that /home/runner/work/_temp/_github_home is mapped to /github/home in default.


In your scenario, I have an idea that you could try to use job container volumes to share data. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts. Here is a simple example. Hope it helps.

Thanks for the help, @niconbw! That requires action on the part of the consumer of the action; is there any way I can pro-actively link the container volume as the creator of the action?

Hi @dfreilich

When the action is running, it will automatically run the docker image and volumes. Therefore the creator of the action cannot customize those map.

Thank you for the help - that definitely helps! One related issue that’s come up - is there any way to use the ubuntu-latest runner as the image in a container? I want to recommend users an image that can work for anything they could conceivably do in other run steps. If not calling image: ubuntu-latest, is the ubuntu-latest image available to refer to directly through Docker Hub or another public Docker registry?