-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Add Docker CLI to Docker image #480
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
Conversation
|
I'd say its better we just include a docker daemon within the container itself like https://hub.docker.com/_/docker Almost all devs will want this so its a good idea to make it work by default. |
|
But it would be unfortunate to make the container privileged. |
You'd be better off mounting the docker daemon from the host machine. Use the following option with a "docker run" command to mount the socket: -v /var/run/docker.sock:/var/run/docker.sock Example: docker run -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:latest |
|
|
That's fair but it won't be restarted often, at least it shouldn't be, and you can always have a custom image with the cache prepopulated. The problem with mounting the socket is that volume mounts won't work at all anymore because the paths passed to the host docker daemon will be resolved from the perspective of the host, not the container. |
I don't believe that to be accurate. Mounting the socket just gives you access to the docker engine. Any other volumes mounted at "docker run" time will still work normally. |
No they won't. Give it a shot. |
Check this out. https://forums.docker.com/t/how-can-i-run-docker-command-inside-a-docker-container/337 |
|
@nhooyr is right here - when you mount the socket, the When I create containers through the terminal in the Code browser window, the volume mount source is the host's filesystem. But... The current image doesn't have the Docker CLI at all, so you can't run containers and this is an improvement :) |
Sort of. This is a very confusing nuance and users will definitely be pissed off after they spend 3 hours debugging it. So, unfortunately this cannot be accepted in its current state. DIND is the only reasonable way to do this. Since almost every user will want access to a docker daemon, I think its a good idea to put it in the default image. |
|
Actually never mind, can't be in the default image as then it requires that the container is privileged. Best we add another image like |
|
Okay, I'll leave you guys to go the |
Describe in detail the problem you had and how this PR fixes it
Run code-server in Docker, then browse and open a terminal. You have access to all the tools installed in the Docker image (e.g. git) but no app runtimes so you can't build or run anything. Adding the Docker CLI into the Docker image will let you mount the Docker engine from the host, and then you can do
docker buildanddocker run.Is there an open issue you can link to?
No. See this blog post for usage.