04.09.2023

Basic Docker commands

Docker — open source popular software for development and deployment. Its advantage lies in the fact that it provides ability of isolation applications, which makes it easy to develop, test and deploy for different environments. Commands of this software provide convenient ability for manage containers and all which everything connected with them (images, networks, volumes, and other). Understanding and using these commands is an important skill for developers and system administrators.

Management

Create from an image and then run

docker run

Start of previously stopped

dockerstart

Shut down container

docker stop

restart

docker restart

Removal

docker rm

Output started

docker ps

log output

docker logs

Creating a new container without running it. The command creates a new container based on the image specified in the command and assigns it a unique ID

docker create

Displaying a list of already started

docker ls

Displaying detailed info

docker inspect

Stop

docker kill

Manage images

Download from storage

docker pull

Building from a so-called Dockerfile

docker build

Submitting to the repository

docker push

Deleting from local storage

docker rmi

Creation history display

docker history

Displaying information about local images

docker images

Network Management

New network

docker network create

Displaying information about networks

docker network ls

Network connection

docker network connect

Disconnecting from networks

docker network disconnect

Working with volumes

Creating a new

docker volume create

List output

docker volume ls

Removal

docker volume rm

Information output

docker volume inspect

Resource management
Displaying container resource usage

docker stats

Suspension of work

docker pause

Resumption of work

docker unpause

Resource Upgrade

docker update

Monitoring and Debugging

Launching command within container

docker exec

Displaying information about images, containers, and networks

docker inspect

Showing processes within a container

docker top

Connecting directly to started container

docker attach

Docker Swarm Support
Running the Docker Swarm initialization procedure on the current node

docker swarm init

Joining a node to Swarm

docker swarm join

Create a service

docker service create

List of running services

docker service ls

These commands represent only a portion of the functions available within Docker. More detailed information on each command can be found in the official Docker documentation. Our aim is for this article to enhance your comprehension of Docker commands and assist you in their practical application.