Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The docker run command display on "devcontainer up" differ from the docker run command seen in strace #910

Open
hpe-ykoehler opened this issue Oct 3, 2024 · 0 comments

Comments

@hpe-ykoehler
Copy link

I have the following scenario, I want to run a jenkins job that will initiate a devcontainer image. I need for example to use the Jenkins pipeline "docker.image().inside()" in order to integrate my jenkins pipeline with devcontainer.

Since I cannot use the devcontainer CLI to start my container I need to use the equivalent "docker run..."

I try to extract the logic from devcontainer up and found that the display at the end

[3346 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/work/krypton/jenkins-agent-image,target=/workspaces/jenkins-agent-image -l devcontainer.local_folder=/work/krypton/jenkins-agent-image -l devcontainer.config_file=/work/krypton/jenkins-agent-image/.devcontainer/devcontainer.json --privileged --entrypoint /bin/sh vsc-jenkins-agent-image-50b5c5a9715e8ac3af6ca2d0f93b30249062d7930045f21fde950743a2176563-uid -c echo Container started

Diffes from the version I found in the strace log

["docker", "run", "--sig-proxy=false", "-a", "STDOUT", "-a", "STDERR", "--mount", "type=bind,source=/work/krypton/jenkins-agent-image,target=/workspaces/jenkins-agent-image", "-l", "devcontainer.local_folder=/work/krypton/jenkins-agent-image", "-l", "devcontainer.config_file=/work/krypton/jenkins-agent-image/.devcontainer/devcontainer.json", "--privileged", "--entrypoint", "/bin/sh", "vsc-jenkins-agent-image-50b5c5a9715e8ac3af6ca2d0f93b30249062d7930045f21fde950743a2176563-uid", "-c", "echo Container started\ntrap \"exit 0\" 15\n/usr/local/share/docker-init.sh\nexec \"$@\"\nwhile sleep 1 & wait $!; do :; done", "-"],

See the missing call to /usr/local/share/docker-init.sh in the output of devcontainer.

I believe this may be a missing escape issue where the \n in the arguments is not escaped before being printed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant