Docker Cheat sheet Series : Docker Machine , Volume

Part 4

pradeep padmarajaiah
1 min readMay 22, 2018

docker-machine version
Current version of installed docker-machine

docker-machine ls
List all the currently running VM’s

docker-machine create — driver virtualbox <docker_machine_name>
Create a new docker machine with the name docker_machine

docker-machine start <docker_machine_name>
Start the docker_machine_name

docker-machine stop <docker_machine_name>
Stop the docker_machine_name

docker-machine ssh <docker_machine_name>
ssh into docker_machine_name

docker volume create <docker_volume_name>
Create a new docker volume called docker_volume_name

docker volume rm <docker_volume_name>
Remove a docker volume called docker_volume_name

docker volume rm $(docker volume ls -q)
Remove all docker volume

docker volume inspect <docker_volume_name>
Inspect the docker volume called docker_volume_name

docker volume prune
Prune all docker volumes which are not used by any of the containers

docker container run — name <container_name> -it -v <volume_name>:<container_folder_name> centos /bin/sh
Mount the container container_name to volume volume_name of container_folder_name inside the container

docker container run — name <container_name> -it -v <volume_name>:<container_folder_name>:ro centos /bin/sh
Mount the container container_name to volume volume_name of container_folder_name inside the container in read only mode

--

--