Docker Blind Mounts & Volumes Implentation
Blind mounts and volumes are two ways to manage persistent data in Docker containers.
Published Feb 4, 2024
Blind mounts and volumes are two ways to manage persistent data in Docker containers.
Let’s discuss each of them and how to implement hands-on practice
Blind mounts, also known as bind mounts, allow you to mount a directory from the Docker host into a container. This means that changes made to files in the mounted directory from either the host or the container are reflected in both places.
If you want to learn more Bind mounts | Docker Docs
Volumes are another way to manage persistent data in Docker containers. Docker volumes are managed by Docker and stored within the Docker data directory. They are often preferred over blind mounts for managing persistent data because they offer better performance and manageability.
If you want to learn more Volumes | Docker Docs
In this syntax: docker run -d — mount source=mani,target=/app nginx:latest
In this syntax:
ubuntu $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1088bfab6648 nginx:latest “/docker-entrypoint.…” 3 minutes ago Up 3 minutes 80/tcp reverent_ramanujan
ubuntu $ docker inspect 1088bfab6648
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1088bfab6648 nginx:latest “/docker-entrypoint.…” 3 minutes ago Up 3 minutes 80/tcp reverent_ramanujan
ubuntu $ docker inspect 1088bfab6648
In this syntax:
docker stop CONTAINER_ID
docker rm CONTAINER_ID
docker rm CONTAINER_ID
If you want more hands-on labs, follow me. I am available at https://linktr.ee/manitechy.