Home > Back-end >  Mount host docker with jenkins container
Mount host docker with jenkins container

Time:12-17

I need to mount host docker with Jenkins container, but problem is docker file is mounted as directory and I can't run docker commands inside Jenkins container.

I am using following command

docker run -p 8080:8080 -p 50000:50000 -d \ -v jenkins-data:/var/jenkins_home/ \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/local/bin/docker:/usr/local/bin/docker jenkins/jenkins:lts

What I am doing wrong here.

Thanks

I also tried to use --mount instead of --volume/-v flag

CodePudding user response:

Docker have issues if you go too fast. ( mounting, filesystems, .... a long long way to go ) Go back to basics, skip Jenkins, try what you want to do in a simple container. Then you may answer your own question.

CodePudding user response:

Don't mount the volume to the host file. This is not recommended and cause permission issue. Use the --privileged flag instead like this.

docker run -p 8080:8080 -p 50000:50000 -d \
  --privileged \
  -v jenkins-data:/var/jenkins_home/ \
  -v /var/run/docker.sock:/var/run/docker.sock \
  jenkins/jenkins:lts
  • Related