Basic Docker Commands

shunmare

shun

Posted on August 3, 2023

Basic Docker Commands

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]
Enter fullscreen mode Exit fullscreen mode

List Images

To list all available Docker images:

docker images [OPTIONS] [REPOSITORY[:TAG]]
Enter fullscreen mode Exit fullscreen mode

Run a Container

To create a new container and start it:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Enter fullscreen mode Exit fullscreen mode

For example, to run a bash shell with Ubuntu:

docker run -it ubuntu bash
Enter fullscreen mode Exit fullscreen mode

List Running Containers

To list all currently running containers:

docker ps [OPTIONS]
Enter fullscreen mode Exit fullscreen mode

Start a Container

To start a previously created or stopped container:

docker start [OPTIONS] CONTAINER [CONTAINER...]
Enter fullscreen mode Exit fullscreen mode

Stop a Container

To stop a running container:

docker stop [OPTIONS] CONTAINER [CONTAINER...]
Enter fullscreen mode Exit fullscreen mode

Remove a Container

To remove a container:

docker rm [OPTIONS] CONTAINER [CONTAINER...]
Enter fullscreen mode Exit fullscreen mode

Remove an Image

To remove an image:

docker rmi [OPTIONS] IMAGE [IMAGE...]
Enter fullscreen mode Exit fullscreen mode

For more information about these commands and their options, please refer to the official Docker documentation.

πŸ’– πŸ’ͺ πŸ™… 🚩
shunmare
shun

Posted on August 3, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related