iamimran
iamimran

Reputation: 110

Mount host docker with jenkins container

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

Upvotes: 0

Views: 280

Answers (1)

Abdulla Nilam
Abdulla Nilam

Reputation: 38652

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

Upvotes: 1

Related Questions