When you start the Jenkins image, you can adjust the configuration of the instance by passing one or more environment variables either on the docker-compose file or on the docker run command line. The following environment values are provided to custommize Jenkins:
| Variable | Default Value | Description |
|---|---|---|
JAVA_ARGS | Configure JVM params |
If you remove the container all your data and configurations will be lost, and the next time you run the image the database will be reinitialized. To avoid this loss of data, you should mount a volume that will persist even after the container is removed.
For persistence you should mount a volume at the /opt/jenkins/data path. The above examples define a docker volume namely jenkins_data. The Jenkins application state will persist as long as this volume is not removed.
To avoid inadvertent removal of this volume you can mount host directories as data volumes. Alternatively you can make use of volume plugins to host the volume data.
docker service create --name jenkins \
-p 8081:8081 \
-p 50000:50000 \
-e JAVA_ARGS="-Xms2G -Xmx6G" \
--mount type=bind,source=/data/jenkins,destination=/opt/jenkins/data \
opcycle/jenkins:latest
When running Docker Engine in swarm mode, you can use docker stack deploy to deploy a complete application stack to the swarm. The deploy command accepts a stack description in the form of a Compose file.
docker stack deploy -c jenkins-stack.yml jenkins
Compose file example:
version: "3.8"
services:
jenkins:
image: opcycle/jenkins:latest
ports:
- 8080:8080
- 50000:50000
volumes:
- jenkins_data:/opt/jenkins/data
deploy:
replicas: 1
restart_policy:
condition: on-failure
environment:
- JAVA_ARGS=-Xms2G -Xmx6G
volumes:
jenkins_data:
driver: local
driver_opts:
type: "none"
o: "bind"
device: "/data/jenkins"
We'd love for you to contribute to this container. You can request new features by creating an issue, or submit a pull request with your contribution.
If you encountered a problem running this container, you can file an issue. For us to provide better support, be sure to include the following information in your issue:
Content type
Image
Digest
sha256:04b7c8e02…
Size
404.8 MB
Last updated
over 3 years ago
docker pull opcycle/jenkins