![docker run image with volume docker run image with volume](https://i.ytimg.com/vi/6rKg9xuWr5Q/maxresdefault.jpg)
These directories are where the container data is physically located on your host system. Once you run the above command, you'll notice all the four fields mentioned earlier inside the Data subsection under GraphDriver. So let's inspect it: :~$ docker inspect confident_banzai Here, the container has been randomly named confident_banzai. When you run docker ps, you'll see that it's running: :~$ docker psĬONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESĬb341d6a28fa alpine "/bin/sh" 6 seconds ago Up 5 seconds confident_banzai Say, for example, I've run the alpine container with docker run -ti -d alpine. If you are looking for the locations of specific containers, you can again use the inspect command on the running container.
#Docker run image with volume driver
Like images, containers are also stored inside the same storage driver based directory. Quoted from this reference (good for further reading). Docker effectively chroot's into this directory when running the container. MergedDir: This is the result of the overlay filesystem. WorkDir: This is a required directory for overlay, it needs an empty directory for internal use. For docker, that is the equivalent of the container specific layer that contains changes made by that container. UpperDir: This is the read-write layer of an overlay filesystem. For docker, these are the image layers assembled in order. LowerDir: These are the read-only layers of an overlay filesystem. In total, there are actually four types of fields:
![docker run image with volume docker run image with volume](https://notes.dmitriydubson.com/img/docker-2.png)
Do take a note of the large hash named directory in the three fields above: 64c9c0cf8c9cfb0e2168071df0652a317d49f58a68fe86e4a9a9a525ab9e365e. "WorkDir": "/var/lib/docker/overlay2/64c9c0cf8c9cfb0e2168071df0652a317d49f58a68fe86e4a9a9a525ab9e365e/work"Īll the above directory paths are the physical locations of the alpine image on the host system. Once you run the command, you'll notice three fields inside the Data subsection under GraphDriver. Run the following command to inspect it: :~$ docker inspect alpine Say, for example, I've pulled the alpine image with docker pull alpine. If you are looking for the locations of specific images, you can use the inspect command on Docker for the pulled image. Availability of the storage driver depends upon kernel support.
![docker run image with volume docker run image with volume](https://linuxconfig.org/wp-content/uploads/2015/05/01-how-to-share-data-between-a-docker-container-and-host-system-using-volumes.png)
Likewise, the directory location would be named as per the same storage driver. If this is different than yours, then you're using a different storage driver for Docker.
![docker run image with volume docker run image with volume](https://cloudonaut.io/images/2019/03/three-ways-to-run-docker-on-aws.jpg)
You can confirm this by running the docker info command and looking for the Storage Driver. Here, Overlay2 is the default Docker storage driver on Ubuntu. Whenever you use the docker pull command or run docker-compose up -d to prepare the launch of applications, this is where images are stored on an Ubuntu server: /var/lib/docker/overlay2 Physically located Docker directories/files should be accessed or manipulated only as a last resort during emergency situations. The docker and docker-compose commands should be the preferred method always. Manipulating with host system Docker directories/files are never actually recommended. Note: Please note that this information is for educational purpose only.