Pull

Pull in an image from the registry.

docker pull <imageName>:<tag>

Run

Run an image that has been downloaded with pull. Names the running image after the given --name argument.

docker run -t -d -p <hostPort>:<containerPort> --name <containerName> <imageName>
  • -t allocates a pseudo terminal for the container
  • -d detaches the process so that it runs in the background
  • -p creates a host to container port mapping

Ps

List out the running containers.

docker ps

Exec

Execute on a running container.

docker exec -it <containerName> <programName>

(program name depends on the image, but common options are bash or sh)

  • -it condenses -i allows interaction with the container, and -t which creates a pseudo terminal and displays it on your screen

Stop

Shutdown a container process.

docker stop <containerName>

Start

Start a previously stopped and idling container.

docker start <containerName>

Stats

Display stats on usage for memory, CPU, network etc. for each container.

docker stats