1. Use docker-compose
# cat docker-compose.yml
version: '2'
services:
jenkinsci:
image: jenkinsci/blueocean
container_name: jenkinsci_blueocean
volumes:
- /data/blueocean/data:/var/jenkins_home
ports:
- 9090:8080
- 50000:50000
Make sure that ports 9090 and 50000 are not occupied. It is good to make sure that /data/blueocean/data has write permission for jenkins.
2. Start
#docker-compose up -d
3. Access
http://ip:9090
You need to enter the initial password and follow the prompts, because the directory has been mapped. For example, if it is placed in the /data/blueocean/data directory, the password file: /data/blueocean/data/secrets/initialAdminPassword