rootless-docker
rootless-docker copied to clipboard
Fail to set rootless mode when docker container action is used
Many Github Actions use Docker container action feature to run their actions within a container.
One of such actions is https://github.com/ammaraskar/sphinx-action, which builds Sphinx documentation within a container Under the hood, it has a action.yml file that calls docker like this:
runs:
using: 'docker'
image: 'Dockerfile'
As a result, github actions calls docker in a way similar to docker run -v "/var/run/docker.sock":"/var/run/docker.sock" ..., that is, it maps /var/run/docker.sock into the container in a hard-coded fashion. https://github.com/actions/runner/pull/1754 is open for 2 years to fix that upstream, but no action was ever taken. This is where I found your action and really hoped it would save my day :)
Here is my repro
- name: Print docker information
run: |
docker info --format "{{ .ClientInfo.Context }}"
- name: Use Docker in rootless mode.
uses: ScribeMD/[email protected]
- name: Print docker information
run: |
docker info --format "{{ .ClientInfo.Context }}"
- name: Build HTML using Sphinx
uses: ammaraskar/sphinx-action@master
The output shows that I was in rootless mode already and after your action I was still rootless. This is expected as this user really uses rootless without the actions kicking in
As a result, the action fail with
Unable to find image 'd3590b:bfe2895916b74aa18c9cb453deb270bb' locally because the rootfull docker is used instead of the rootless, in which context the image doesnt exist.
It seems the -v mapping take precedence over everything, so your action doesnt work. Any way you could find a workaround and make your action even more powerful?