What is Docker Volume | How to create Volumes | What is Bind Mount | Docker Storage

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • 11:26 Bind mount
    More about Raghav - automationstep...
    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
    hub.docker.com...
    docs.docker.co...
    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
    • Docker
    RUclips PLAYLIST
    / @raghavpal
    RUclips
    / automationstepbystep
    FACEBOOK
    / automationstepbystep
    TWITTER
    / 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 - automationstepb...
    ----------- Follow -----------
    RUclips - / automationstepbystep
    Share your knowledge with everyone and,
    Never Stop Learning
    Raghav

Комментарии • 613