PROBLEM
Let’s assume we have the following docker-compose.yml
:
version: '2' services: jenkins: image: "jenkinsci/jenkins" ports: - "8080:8080" volumes: - jenkins:/var/jenkins_home volumes: jenkins:
By the default, all Docker-managed named volumes are stored under the installed Docker directory… typically, /var/lib/docker/volumes/[path]
.
However, it is possible /var
mount is low on disk space.
SOLUTION
It appears we can create a custom location for the given named volume:-
version: '2' services: jenkins: image: "jenkinsci/jenkins" ports: - "8080:8080" volumes: - jenkins:/var/jenkins_home volumes: jenkins: driver_opts: type: none device: /data/jenkins o: bind
Keep in mind /data/jenkins
must be created first on the host.
Excellent! Thanks a lot!
Awesome! Thank you!