Starting Jenkins in Docker Container

好久不见. 提交于 2019-12-03 13:31:26

The official Jenkins Docker image documentation says regarding volumes:

docker run -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins

This will store the jenkins data in /your/home on the host. Ensure that /your/home is accessible by the jenkins user in container (jenkins user - uid 1000) or use -u some_other_user parameter with docker run.

This information is also found in the Dockerfile. So all you need to do is to ensure that the directory $PWD/jenkins is own by UID 1000:

mkdir jenkins
chown 1000 jenkins
docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home -t jenkins

The newest Jenkins documentation says to use Docker 'volumes'. Docker is kinda tricky on this, the difference between the two is a full path name with the -v option for bind mount and just a name for volumes.

docker run -d -p 49001:8080 -v jenkins-data:/var/jenkins_home -t jenkins

This command will create a docker volume named "jenkins-data" and you will no longer see the error.

Link to manage volumes: https://docs.docker.com/storage/volumes/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!