Docker image based on jenkins/jenkins:lts with docker CLI on master node.
-
Start jenkins :
docker-compose up -d
-
Retrieve initial password :
docker exec -ti jenkins cat /var/jenkins_home/secrets/initialAdminPassword
You may add the following environment variables to write portable Jenkinsfile :
Variable | Description | Example |
---|---|---|
DOCKER_REGISTRY | Hostname for docker registry | registry.${HOST_HOSTNAME} |
DOCKER_REGISTRY_URL | URL for docker registry | https://registry.${HOST_HOSTNAME} |
DOCKER_REGISTRY_CREDENTIAL_ID | Jenkins credential id to access registry (username/password) | nexus_user |
- This approach could not be the best one for production purpose. See ~jpetazzo/Using Docker-in-Docker for your CI or testing environment? Think twice.
- Jenkins is added to docker group at runtime if
unix:///var/run/docker.sock
is mounted (deprecated)