Docker Notes

> docker version
> docker info

# Run a new container
> docker run hello-world

# See running and stopped containers
> docker ps
> docker ps -a

> docker pull ubuntu # this pulls the latest version
> docker pull ubuntu:14.04
> docker rmi ubuntu:14.04

# Run image in interactive mode
# The following command enters to ubuntu (image) bash
> docker run -it --name temp ubuntu:latest /bin/bash 

# Don't type exit in the interactive shell because 
# it will kill the container as well 
>> Ctrl P + Q # to exit interactive shell 

# Stop all running instances 
# -aq: a is all and q is quietly 
> docker stop $(docker ps -aq) 
> docker rm $(docker ps -aq) 
> docker rmi $(docker images -q) 

Continue reading