Docker is a powerful tool for creating, deploying, and running applications using containerization. Here are some basic Docker commands you might find useful:
Pull an Image
To download an image from Docker Hub or another Docker registry:
docker pull [OPTIONS] NAME[:TAG|@DIGEST]
List Images
To list all available Docker images:
docker images [OPTIONS] [REPOSITORY[:TAG]]
Run a Container
To create a new container and start it:
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
For example, to run a bash shell with Ubuntu:
docker run -it ubuntu bash
List Running Containers
To list all currently running containers:
docker ps [OPTIONS]
Start a Container
To start a previously created or stopped container:
docker start [OPTIONS] CONTAINER [CONTAINER...]
Stop a Container
To stop a running container:
docker stop [OPTIONS] CONTAINER [CONTAINER...]
Remove a Container
To remove a container:
docker rm [OPTIONS] CONTAINER [CONTAINER...]
Remove an Image
To remove an image:
docker rmi [OPTIONS] IMAGE [IMAGE...]
For more information about these commands and their options, please refer to the official Docker documentation.
Top comments (0)