Docker Commands

View all images

docker images

View all containers

docker ps

View all active containers

docker ps -a

Run image

docker run myimage

Run image, with interactive TTY console

docker run -it myimage

Exit TTY console

CRTL-D

Remove all inactive containers

docker container prune

Inspect a container

docker inspect CONTAINERID

Stop a container

docker stop a7a0e504ca3e

Execute a command in a container

docker exec CONTAINERID cat /etc/hosts

View container ports

docker port container-name

View docker network interfaces

docker network ls

View container IP address

docker inspect 1eec29b9e4c3 --format=''

Resources