Where are Docker images stored on the host machine?

后端 未结 29 2258
逝去的感伤
逝去的感伤 2020-11-22 06:28

I managed to find the containers under directory /var/lib/docker/containers, but I can\'t find the images.

What are the directories and files under

29条回答
  •  攒了一身酷
    2020-11-22 07:08

    I couldn't resolve the question with Docker version 18.09 on macos using the above answers and tried again.

    The only actual solution for me was using this docker-compose.yml configuration:

    version: '3.7'
    ...
      services:
        demo-service:
          volumes:
            - data-volume:/var/tmp/container-volume
    
    volumes:
      data-volume:
        driver: local
        driver_opts:
          type: none
          o: bind
          device: /tmp/host-volume
    

    After launching with docker-compose up I finally had /tmp/host-volume from macos shared as writeable volume from within the container:

    > docker exec -it 1234 /bin/bash
    bash-4.4$ df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    ...
    osxfs                488347692 464780044  21836472  96% /var/tmp/container-volume
    

    Hope this helps others too.

提交回复
热议问题