Use Docker containers from the command line

The Docker Desktop application is great, and containers can be used locally through a graphical interface.

You don't need to use it. You can use CLI commands.

Thisdocker psThe command lists the currently running containers:

This is the same as runningdocker container ls.

In this case, the container namenode-appAnd ID739037a911e0Generate from imageexamplenode,It has been established4 minutes ago, Has been open since 4 minutes, and uses TCP protocol to map the host's port 80 to the container port 3000.

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

docker container stop <ID>

After stopping the container, you can usedocker container ls -a:

You can delete it usingdocker container rm:

docker container rm <ID>

You can check all the details about the container runningdocker inspect:

Another useful CLI command isdocker infoIt gives you a lot of information about the current state of the Docker installation, including the number of containers and images.

More docker tutorials: