Where docker named volumes are stored? [duplicate]

2019-07-05 05:30发布

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.

1条回答
Fickle 薄情
2楼-- · 2019-07-05 06:23

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.

查看更多
登录 后发表回答