DevOps(Day-21) : Docker Network and Volumes for DevOps
TABLE OF CONTENTS
Docker-Volume
Docker-Network
Docker-Volume
Docker allows mounting the filesystems as a volume to the containers. These volumes preserve all the data of the container and the data is persisted even if the container is deleted.
The default path is /var/lib/docker/volumes/ on Linux.
A volume can be mounted to multiple containers and it lies even if all containers are down. It can be removed only manually by the user.
Creating a Docker Volume
$docker volume create [volume_name]
Listing a Docker Volume
$docker volume list
Mounting a volume.
docker run --mount source=[volume_name],destination=[path_in_container] [docker_image]
Removing a Volume.
$docker volume rm [volume_name]
Deleting all volumes at once.
$docker volume prune
Docker-Network
With Docker-Compose we create multiple containers, in that process, a space is created by Docker where those containers can communicate with each other and the host system. That space is known as Docker Network.
$docker network COMMAND
The COMMAND can be connected, create, disconnect, inspect, ls, prune, and rm.
Thanks for reading my article. Have a nice day.
Comments
Post a Comment