Student Reviews
( 5 Of 5 )
1 review
Video of What is Docker Volume How to create Volumes What is Bind Mount Docker Storage in Docker course by Automation Step by Step channel, video No. 14 free certified online
11:26 Bind mount
More about Raghav - https://automationstepbystep.com/
Today we will learn:
1. What are Volumes
2. How to create / list / delete volumes
3. How to attach volume to a container
4. How to share volume among containers
5. What are bind mounts
Volumes are the preferred mechanism for persisting data generated by and used by Docker containers
: docker volume //get information
: docker volume create
: docker volume ls
: docker volume inspect
: docker volume rm
: docker volume prune
Instead of deleting containers one by one of docker ps -a , we can use docker container prune. and for docker ps (running containers) we can use docker rm $(ps -aq)
Use of Volumes
Decoupling container from storage
Share volume (storage/data) among different containers
Attach volume to container
On deleting container volume does not delete
Commands
docker run --name MyJenkins1 -v myvol1:/var/jenkins_home -p 8080:8080 -p 50000:50000 jenkins
docker run --name MyJenkins2 -v myvol1:/var/jenkins_home -p 9090:8080 -p 60000:50000 jenkins
docker run --name MyJenkins3 -v /Users/raghav/Desktop/Jenkins_Home:/var/jenkins_home -p 9191:8080 -p 40000:50000 jenkins
References
https://hub.docker.com/_/jenkins/
https://docs.docker.com/storage/volumes/
NOTES
By default all files created inside a container are stored on a writable container layer
The data doesn’t persist when that container is no longer running
A container’s writable layer is tightly coupled to the host machine where the container is running. You can’t easily move the data somewhere else.
Docker has two options for containers to store files in the host machine
so that the files are persisted even after the container stops
VOLUMES and BIND MOUNTS
Volumes are stored in a part of the host filesystem which is managed by Docker
Non-Docker processes should not modify this part of the filesystem
Bind mounts may be stored anywhere on the host system
Non-Docker processes on the Docker host or a Docker container can modify them at any time
In Bind Mounts, the file or directory is referenced by its full path on the host machine.
Volumes are the best way to persist data in Docker
volumes are managed by Docker and are isolated from the core functionality of the host machine
A given volume can be mounted into multiple containers simultaneously.
When no running container is using a volume, the volume is still available to Docker and is not removed automatically. You can remove unused volumes using docker volume prune.
When you mount a volume, it may be named or anonymous.
Anonymous volumes are not given an explicit name when they are first mounted into a container
Volumes also support the use of volume drivers, which allow you to store your data on remote hosts or cloud providers, among other possibilities.
#DockerVolume #DockerBindMount #DockerContainers #DockerTutorials #DockerTraining #DevOpsTools #DevOpsTraining #DockerCommands #DockerForBeginners #DockerFreeTutorials #DockerforDevOps
DOCKER PLAYLIST
https://www.youtube.com/playlist?listPLhW3qG5bs-L99pQsZ74f-LC-tOEsBp2rK
YOUTUBE PLAYLIST
https://www.youtube.com/channel/UCTt7pyY-o0eltq14glaG5dg/playlists
YOUTUBE
https://www.youtube.com/automationstepbystep
FACEBOOK
https://www.facebook.com/automationstepbystep
TWITTER
https://twitter.com/automationsbs
If you like videos on the channel Automation Step by Step, hit the like button and share with others.
Click the SUBSCRIBE button and hit the bell icon to keep getting new videos.
________ ONLINE COURSES TO LEARN ________
Visit - http://automationstepbystep.com/
------------ Follow ------------
Youtube - http://youtube.com/automationstepbystep
Share your knowledge with everyone and,
Never Stop Learning
Raghav