How to deploy jenkins in docker

  docker, question

I first use the command to pull the mirror image

docker pull jenkins

Then run

mkdir /var/jenkins_home
 docker run -d --name myjenkins -p 49001:8080 -v /var/jenkins_home:/var/jenkins_home jenkins

Then I opened it when I checked with the command.

docker ps -a

The result is
图片描述

The status value displayed is exit (1).

What is the reason?

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.
https://hub.docker.com/_/jenkins/