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

Can't use host docker daemon from container #4642

Closed
GabrielBB opened this issue Sep 3, 2019 · 6 comments
Closed

Can't use host docker daemon from container #4642

GabrielBB opened this issue Sep 3, 2019 · 6 comments

Comments

@GabrielBB
Copy link

GabrielBB commented Sep 3, 2019

No matter what I and a co-worker try, we can't connect to the docker daemon in our Windows host. I check that the container has the /var/run/docker.sock file but we still get a "docker: command not found" when executing docker exec -t ${container} docker ps. We are not using a windows container.

This is how I'm running the container:

docker run -d -p 49001:8080 -v "D:/container_volumes/jenkins":/var/jenkins_home:z -v /var/run/docker.sock:/var/run/docker.sock -t jenkins/jenkins

I also tried with my personal computer. According to this post it should work.

OS: Windows 10 Pro
Docker Desktop version: 2.1.0.1 (37199)
Image: jenkins/jenkins

@mccarthysean
Copy link

@GabrielBB, I created a GitLab repo for you to clone and test, which connects a Linux Docker container (in which you can develop your code with VS Code) to your Windows Docker host. Hope it helps!

It requires Docker Desktop for Windows, VS Code, and the "Remote Development" extension for VS Code.

I think you'll like it!
-Sean

@naamancampbell
Copy link

As per this Container Solutions post, the Docker binary also needs to be mounted onto the Jenkins container. The Docker binary is located in /usr/local/bin/docker on Windows Docker-Desktop.

-v /usr/local/bin/docker:/usr/bin/docker

I also needed to add --user root to the docker run command to enable access to the Docker UNIX socket.

@GabrielBB
Copy link
Author

GabrielBB commented Oct 2, 2019

@naamancampbell OMG Finally. "-v /usr/local/bin/docker:/usr/bin/docker" worked! For some reason everybody says that "/var/run/docker.sock:/var/run/docker.sock" should work on Windows too but it didn't. Thanks ! Closing Issue

@GabrielBB
Copy link
Author

@stringang
Copy link

stringang commented Dec 20, 2019

Windows10:

docker run \
-v /var/run/docker.sock:/var/run/docker.sock \
--user root \
images:tag

solve this problem

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jul 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants