Docker Volume
Data volumes are directories that can store data outside Docker containers. This data can be shared among containers and is persistent.
The data volumes are usually stored in the folder ‘/var/lib/docker/volumes’ and can be listed using the command ‘docker volume ls’.
Docker image ?
A Docker image is a file, comprised of multiple layers, that is used to execute code in a Docker container.
What is Docker ? – Docker is a containerization platform that packages your application and all its dependencies together in the form of a docker container to ensure that your application works seamlessly in any environment.
What is Container ? – Docker Container is a standardized unit which can be created on the fly to deploy a particular application or environment. It could be an Ubuntu container, CentOs container, etc. to full-fill the requirement from an operating system point of view. Also, it could be an application oriented container like CakePHP container or a Tomcat-Ubuntu container etc.
To create volume
# docker volume create --name DataVolume1
To run container using create voluem
# docker run -ti --rm -v DataVolume1(host volume):/datavolume1(directory_name into docker) ubuntu(name of image)
To inspect volume
# docker volume inspect DataVolume1
To create volume with container name
# docker run -ti --name=Container2 -v DataVolume2:/datavolume2 ubuntu
To create container from cotainer2 volume
# docker run -ti --name=Container3 --volumes-from Container2 ubuntu
No Comments