The official Jenkins image is available on Docker Hub.
version: '3.8'
services:
jenkins:
image: jenkins/jenkins:jdk11
restart: always
privileged: true
user: root
ports:
- '8081:8080'
- '50000:5000'
container_name: jenkins_jdk11
volumes:
- ~/Desktop/self-hosted/jenkins_home:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
You can map
/var/jenkins_home to any local path you prefer. The path shown (~/Desktop/self-hosted/jenkins_home) is just an example.