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 ps
The command lists the currently running containers:
This is the same as running
docker container ls
.
In this case, the container namenode-app
And ID739037a911e0
Generate 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 info
It gives you a lot of information about the current state of the Docker installation, including the number of containers and images.
More docker tutorials:
- Introduction to Docker
- Introduction to Docker images
- Introduction to Docker containers
- Dockerfiles
- Install Docker on macOS
- The first step to use Docker after installation
- Use Docker Desktop to manage containers
- Create a simple Node.js Hello World Docker container from scratch
- What to do if the Docker container exits immediately
- Use Docker containers from the command line
- Use Docker image from the command line
- Share Docker images on Docker Hub
- How to access files outside the Docker container
- How to commit changes to the Docker image
- Update the deployed container based on the Docker image