Docker Volumes
- Docker volumes have a life time independent of docker container.
- Volumes act as mount onto a specific folder(s) in a container
- Docker volumes and Refer Here for the article
- Types:
- Volumes:
- Create a volume which gets create in /var/lib/docker
- And mount the volume to a folder in container.
- Bindmounts:
- Mount an existing folder on dockerhost into container.
- tmpfs
- Volumes:
- Lets create a simple alpine container with a bindmount (/home/Dell/docs -> /docs)
docker container run -d --name bindmountdemo -v /home/Dell/docs:/docs alpine sleep 1d
- execute experiment commands commands such as (Watch classroom video)
- df -h
- ls
- cat
Lets use the volume
- Create a volume
docker volume create --help


- We can create volume by default even if the user doesnot create a volume that is by adding
VOLUMEinstruction in Dockerfile.
FROM alpine
RUN mkdir /docs
VOLUME /docs
CMD ["sleep", "1d"]

- Watch classroom recording for mysql
Docker networking
- Docker has two major types of networking
- single host (developer setup)
- multi host (docker swarm): This is not an area of interest for us as we will be exploring kubernetes for multi host .
- Network also is implemented as a driver Refer Here
- Port Forwarding.

