I run my Jenkins as a Docker container with the command below
docker run \
-u root \
--rm \
-d \
-p 8081:8080 \
-p 50000:50000 \
-v /data/jenkins-data:/var/jenkins_home \
-v /var/run/docker.sock:/var/run/docker.sock \
jenkinsci/blueocean
From time to time, the jenkins container will exit. I even can't find it with "docker ps -a" command, so that I can't get any logs for troubleshooting.
Is there any way I can check the reason why a docker container exits like this?
--rm
flag to let the container not be removed post termination. Then you can usedocker ps -a
followed bydocker logs <container id>
to see why