This question already has an answer here:
I have this docker-compose.yml
file
version: '3'
volumes:
jenkins_home:
services:
registry:
image: registry:2
ports:
- "5000:5000"
jenkins:
image: jenkins/jenkins
ports:
- "9090:8080"
volumes:
- jenkins_home:/var/jenkins_home
As you can see, there is a named volume called jenkins_home
, now I wonder, where does the data get really persisted?
running docker inspect infra_jenkins
i got this:
...
"Mounts": [
{
"Type": "volume",
"Source": "infra_jenkins_home",
"Target": "/var/jenkins_home",
"VolumeOptions": {
"Labels": {
"com.docker.stack.namespace": "infra"
}
}
}
],
...
I am running those services on a local docker swarm cluster using docker stack deploy
command, the cluster is composed of three VirtualBox instances.
You can inspect docker volumes and see detailed informations.
See docker volume reference
Edit (commented suggestion):
Alternatively (for exact answer) see the already answered question.