Images
-
docker pull: download images from remote registries. -
docker images: list all images stored in localhost -
docker inspect: display all details of an images (layer data and metada) -
docker manifest inspect: display the manifest list of any image stored on Docker Hub. -
docker buildx: Docker CLI plugin that extends the Docker CLI to support multi-arch builds. -
docker rmi: delete image.
Containers
-
docker run: start a new container -
Ctrl-PQ: detach the shell from the terminal of a container and leave the container running in the background. -
docker ps: list all containers in the running state. The-aflag also display stopped contaners. -
docker exec: runs a new process inside of a running container. It's useful for attaching the shell of the Docker host to a terminal inside a running container. -
docker stop: stops a running container and put it in the exited(0)state. -
docker start: restarts a stopped container. -
docker rm: deletes a stopped container. -
docker inspect: displays detailed configuration and runtime information abut a container.
Containerizing an app
-
docker build: reads aDockerfileand containerizes an application. The-tflag tags the image, and the-fflag lets you specify the name and location of theDockerfile. -
The Dockerfile
FROMinstruction specifies the base image for the new image you're building. -
The Dockerfile
RUNinstruction lets you to run commands inside the image during a build. EachRUNinstruction adds a new layer to the overall image. -
The Dockerfile
COPYinstruction adds files into the image as a new layer. -
The Dockerfile
EXPOSEinstruction documents the network port an application uses. -
The Dockerfile
ENTRYPOINTinstruction sets the default application to run when the image is started as a container.