Docker run -v inside container #26360
-
Hey everyone, im trying to do a “docker run -v” with a volume inside a container but the mounted directory seems to come back empty.
The last ls -lah executed with the Is it possible to mount again inside a running container? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
For job containers the Docker control socket is mounted from the runner VM into the container, so the volume paths need to be paths as on the runner. In particular, I’ve encountered the workspace paths being different (also via volume mounts into the job container). From the snippet above I’m not sure how the paths would need to look to work, but that’s a likely reason. |
Beta Was this translation helpful? Give feedback.
-
@airtower-luna thanks for the suggestion. Any chance you have some links to more reading? Im afraid ive exhausted all my search terms. The closest i’ve gotten to finding something is this: GoogleCloudPlatform/cloud-builders#372 (comment)
But I think the -name path: syntax has been deprecated on github actions |
Beta Was this translation helpful? Give feedback.
-
That has never been Github Actions syntax as far as I know, the stuff in that repository is for Google Cloud Build, which looks a bit similar because it’s YAML, too. The point I was trying to make is that your job runs in a container (the
If you want to see what is mounted where in your job container, check the “Initialize containers” step near the start of your workflow. You’ll notice that the Docker command to create the job container includes this:
This means any Docker command in the container will talk to the Docker daemon on the runner VM. So any path for volume mounts will be interpreted from the runner VM, not inside your container. |
Beta Was this translation helpful? Give feedback.
-
@airtower-luna thank you!! Put me on the right path. I managed to get working now after looking at the
and then later after checking out the repo I
Now inside the next container I can finally see the contents. Still a bit rough on the edges but at least its a start. Thanks again! |
Beta Was this translation helpful? Give feedback.
That has never been Github Actions syntax as far as I know, the stuff in that repository is for Google Cloud Build, which looks a bit similar because it’s YAML, too.
The point I was trying to make is that your job runs in a container (the
lambci/lambda:build-nodejs12.x
one). The paths inside that container are not going to be the same as on theubuntu-latest
runner VM.GITHUB_WORKSPACE
is an example I specifically had trouble with while uploading SARIF for the security tab. Thegithub/codeql-action/upload-sarif
action needs to make any absolute paths in the file to be uploaded relative (so any issues found can be assigned to files in the repository). By default it assumes the base path fo…