Docker Machine

To start a docker machine:

docker-machine start

To stop a docker machine:

docker-machine stop

Show IP address of default docker machine:

docker-machine ip default

Connect to docker daemon:

eval $(docker-machine env)

Connect to docker daemon (Windows equivalent):

@FOR /f "tokens=*" %i IN ('docker-machine env') DO @%i

Docker Compose

To build docker-compose file. Images will be downloaded and containers will be created as specified.

docker-compose build

Start the docker containers.

docker-compose up -d

Docker Container

To start a docker container:

docker start <container>

To stop a docker container:

docker stop <container>

Delete a docker container by ID. Force (-f) enables one to delete a running container. You can pass multiple container IDs.

docker rm -f <containers>

Show all IDs of running and stopped containers.

docker ps -aq

Connect to a shell in the docker container and execute the command.

docker exec -it <container> <command>

Docker Images

Show all IDs of docker images.

docker images -aq

Delete docker images by ID. Force (-f) enables one to delete an image although others depend on it. You can pass multiple image IDs.

docker rmi -f <images>