Accessing Docker Volume content on MacOS

后端 未结 3 1025
栀梦
栀梦 2020-12-30 14:19

When I do a docker volume inspect on a Mac, I can see the path to the data, this appears as a /var/lib/docker/volumes/

3条回答
  •  忘掉有多难
    2020-12-30 14:32

    for example, you create a Volume with a File Docker-Compose.yml:

    ...

    influxdb:
     image: influxdb:latest
     container_name: influxdb
     restart: always
     ports:
       - "8086:8086"
       - "9092:9092"
     volumes:
      - type: volume
        source: vol_influxdb
        target: /var/lib/influxdb
    

    ...

    You can't find this Volume "vol_influxdb" on your Mac, because it's in the Docker-VM. Start your Mac-Terminal an Enter:

    screen /Users//Library/Containers/com.docker.docker/Data/vms/0/tty 
    

    Now you are in the Docker-VM and you can search your Volume with:

    cd /var/lib/docker/volumes//_data/
    

提交回复
热议问题