Skip to content

Working with Docker Containers from the command line

New Course Coming Soon:

Get Really Good at Git

The Docker Desktop application is awesome to work with containers locally via a graphical interface.

You are not required to use it. You can use the CLI commands.

The docker ps command lists the currently running containers:

This is the same as running docker container ls.

In this case, container with name node-app and ID 739037a911e0 generated from the image examplenode, created 4 minutes ago, is up since 4 minutes, and the port 80 of the host machine is mapped to the container port 3000 using the TCP protocol.

When you know the contained ID, you can stop the container by running

docker container stop <ID>

Once a container is stopped, you can see it using docker container ls -a:

And you can remove it using docker container rm:

docker container rm <ID>

You can inspect all the details about a container running docker inspect:

Another useful CLI command is docker info which gives you lots of information about the current state of your Docker installation, including the number of containers and images.

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching Summer 2024. Join the waiting list!

Here is how can I help you: