Volume — inside docker host
- It creates volume automatically if it is not present
- Create volume using command -
docker run — mount src=”$(pwd)”,target=$HOME/app,type=volume webapp:1.0
Bind — outside docker host but on host machine.
- It does not create a directory if not present but will send an error
- Add mount using the command
docker run — mount src=”$(pwd)”,target=$HOME/app,type=bind webapp:1.0
The type parameter itself mentions its approach. Both the approach have their own merits and demerits. In one line volume is crated inside the docker host machine so those are platform independent where host mount is dependent on the host machine so command and paths may differ in second approach.