DEV Community

shun
shun

Posted on • Edited on

1

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.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay