8 Most important docker commands for beginner

Docker

These are the most important commands that everyone must know. If you try to run all these commands and see the output, then it will be easier to understand them.

1. Docker ps 2. Docker run 3. Docker exec 4. Docker images 5. Docker stop 6. Docker kill 7. Docker rm 8. Docker rmi

Docker ps

Docker ps command is used to list containers’ details. By default it lists all running containers. We can use different options to control the list.

Syntax:

docker ps [OPTIONS]

Docker run

Docker run is the most used and most powerful command. This command is used to create new docker container from docker image.

Syntax:

docker run [OPTIONS] IMAGE [COMMAND] [ARG…]

Docker exec

The docker exec command is used to run a new command in already running container.

Syntax:

docker exec [OPTIONS] CONTAINER_ID/NAME COMMAND [ARG…]

Docker images

This command is used to list downloaded images, sometimes it is useful see all downloaded images.

Syntax:

Docker images

Docker stop

Docker stop command is used to stop one or more running container with 10 seconds of default waiting time.

Syntax:

docker stop container1 [containers . . ]

Docker kill

Docker kill command is used to stop one or more running container forcefully.

Syntax:

docker kill container1 [containers …]

Docker kill

Docker kill command is used to stop one or more running container forcefully.

Syntax:

docker kill container1 [containers …]

Docker rm

Docker rm command deletes one or more container.

Syntax:

docker rm [OPTIONS] CONTAINER [CONTAINER…]

Docker rmi

Docker rmi command is used to delete one or more downloaded images. This command helps to free up memory by deleting not required images.

Syntax:

docker rmi [OPTIONS] IMAGE [IMAGE…]