Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 1009 Bytes

File metadata and controls

55 lines (45 loc) · 1009 Bytes

Docker Reference

List container images

docker image ls

Pull a container image

docker image pull centos:latest

Run a container

docker container run --detach --name centos centos:latest

Run a container and map a local port to the container port

docker container run --detach --name httpd --publish 8080:8080 httpd:latest

Run a container interactively

docker container run --tty --interactive --name centos-bash centos bash

Run an additional command in a container interactively

docker container exec --tty --interactive --name centos-bash centos bash

List container logs

docker container logs httpd

List containers

docker container ps

Remove container

docker container rm --force httpd centos centos-bash

Remove all containers

docker container rm --force $(docker container ls --all --quiet)

Remove all images

docker image rm --force $(docker image ls --all --quiet)