Docker Commands

View all containers

docker ps

Exec into container

docker exec -u root -it <container> bash

Copy file into container

docker cp



Other

View all images

docker images

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