statistics and info commands
show container usage statistics
docker stats
show running process from a container
docker top pc
show the logs from a container
docker logs -f pc
show container log path
docker inspect --format='{{.Name}} {{.LogPath}}' pc
show docker disk usage
docker system df
show all IPs from a container
docker inspect --format='{{.Name}} {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pc
show mac address from a container
docker inspect --format='{{.Name}} {{range .NetworkSettings.Networks}}{{.MacAddress}}{{end}}' pc
show all ports binding from a container
docker inspect --format='{{.Name}} {{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' pc
images commands
search for images on docker hub
docker search debian
docker search -f is-official=true debian
list images
docker images
remove a image
docker rmi debian
container commands
list all container and their status
docker ps -a
create a docker container (it will download the image if it doesn’t exist)
docker create -i --name pc debian
start a container
docker start pc
enter in a container
docker exec -it pc bash
stop a container
docker stop pc
docker stop -t0 pc
remove a single container ( -f will force remotion if it running )
docker rm pc
docker rm -f pc
remove all stopped containers
docker container prune
command options
docker
docker create --help
docker start --help
docker exec --help