Docker Container Cheat Sheet



A Docker image is a static model containing a preinstalled application. When running this image, a container is created. An image can be used to start as many containers as needed. The following diagram shows the life cycle of a Docker container and associated commands.

Docker Container Cheat Sheet

Docker is fantastic tool for building out your infrastructure, however it does have a fairly steep learning curve. That’s why I created this Docker Cheat Sheet. I was constantly looking up what docker commands I needed to run to build an image from a dockerfile, run a container, mount a volume, etc. Windows Containers (personal) cheat sheet. The container had nothing exposed to the standard output, so when you started the container or tried to see the logs via docker logs nothing was there. Docker is an open-source platform that can be used to build, ship, and run applications by packaging software in containers. Docker has a lot of commands and options, and it is very difficult to remember every command. This article provides a cheat sheet of the most commonly used Docker commands.

There are two ways of getting a Docker image:

  • Retrieve a Docker image from a registry (often Docker Hub).
  • Build it from a Dockerfile. All standard Jahia and jCustomer Docker images are available as public Docker Hub images.

Docker command cheat sheet

To list all running containers, execute this Docker command: 7z archive for mac.

To list all the containers on your machine, including the ones that are stopped or exited:

Docker Container Cheat Sheet

Note: For more options, refer to the Docker documentation.

Cli

To run a container in detached mode:

Docker Container Cheat SheetDocker

The command executes the container and returns the container’s UUID. You may need the command if you have not named your container.

In detached mode, you can still display the standard output logs of the container in a console by executing this Docker command:

To stop a container:

As an alternative, the CTRL+C shortcut (COMMAND+C on macOS) stops the container started in attached mode.

Docker Compose Command Cheat Sheet

Container

To start a container:

To delete a container:

Docker Container Cheat Sheet Template

To remove and start a new container with a given name, add --rm as a parameter to the run command: