# Docker Commands
* `docker images` : list images on the docker host
* `docker pull <image-name>` : copies images to docker host
* `docker run <image-name>` : start container from image
* `docker info` : show information about docker
* `docker version` : show docker version
* `docker ps` : list running containers
* `docker ps -a`
* `docker rmi <image-name>` : remove docker image from docker host
* `docker stop $(docker ps -aq)` : stop all active containers
* `docker rm $(docker ps -a)` : remove all active container
* `docker rmi $(docker ps -q)` : remove all docker images
* `docker rm <container id>` : remove stopped containers
* `docker rm -v <container-id>` : remove container with its volumes
* `docker stop <container-id>` : stop running containers
* `docker run -p 8080:3000 -v /var/www node` : run docker with custom volume /var/www into container
* `docker run -p 8080:3000 -v $(pwd) /var/www node` : un docker using local location as host location and mount it into container in /var/www
* `docker inspect <container-id>` : shows mounted volume for container
* `docker build -t <username>/<app-name> .` : build docker image with tag
* `docker build -f DockerFile -t <username>/<app-name> .` : build docker image with certain docker file name
* `docker run -d —name my-postgres postgres` : run container with certain name for linking
* `docker run -d -p 3000:3000 —link my-postgres :postgresdb <image-name>` : link other containers
* `docker exec <container-id> <command>` : to execute command in container
**Note**:
`docker run -d /-it <image-name>`
> -d to run in background
> -it to interact with container terminal