Docker Shared Volume Tutorial between two containers | Docker Volume Mount Demo in Windows 11

preview_player
Показать описание
Docker installation in Windows 11 with WSL:-
WSL+Docker+Apple MacOS X Big Sur installation in Windows 11

docker volume create sonooskbvol //Volume Name

Verify Volume by command and GUI
docker volume ls

Attach Volume with two new containers

docker run -it -v sonooskbvol:/shared-volume --name my-container-01 ubuntu
[Ctrl] + [P] and [Ctrl] + [Q] and return to the host machine’s command prompt

docker run -it -v sonooskbvol:/shared-volume --name my-container-02 ubuntu
[Ctrl] + [P] and [Ctrl] + [Q] and return to the host machine’s command prompt

Verify data in both container
docker exec -it my-container-01 /bin/bash
docker exec -it my-container-02 /bin/bash

Deleting both the container
docker stop my-container-01
docker rm my-container-01
docker stop my-container-02
docker rm my-container-02

Verify Volume
docker volume ls

Attaching same volume to third container to verify data persist or not

docker run -it -v sonooskbvol:/shared-volume --name my-container-03 ubuntu

Can docker volumes be shared?
Can two containers share the same volume?
How do I share volume between containers?
How do I share docker volumes across hosts?

docker mount volume example
docker mount volume to running container
docker volume
docker-compose volumes
docker-compose volumes example
docker create volume from local directory
docker volume vs bind mount
docker volume types
Рекомендации по теме
Комментарии
Автор

Okey you can access to shared volume within containers but can i access volume from wsl or ubuntu? i mean in your example the sonooskbvol volume

vooroorxxx
Автор

How to do the same think in docker-compose between the imagen of services ?

daironperezfrias