Author: Vincent Lau
Note: This material is intended for educational purposes only. All rights reserved. Any unauthorized sharing or copying of this material, in any form, to any individual or party, for any use without prior permission, is strictly prohibited.
This chapter you will get to know basic docker commands, which can be used in Docker CLI to interact with Docker Daemon.
Docker Daemon is the background service responsible for managing Docker containers, images, volumes, networks, and other Docker resources.
Docker CLI provides a set of commands that allow you to control and manage Docker resources.
Building Docker images from a Dockerfile: The docker build command is used to build a Docker image based on the instructions specified in a Dockerfile.
Running containers: The docker run command is used to create and start a new container from a Docker image.
Managing containers: The Docker CLI provides commands to start, stop, restart, pause, or remove containers. For example, docker start, docker stop, docker restart, docker pause, and docker rm are some of the commands used for managing containers.
Managing images: You can use the Docker CLI to pull Docker images from a registry using the docker pull command, as well as to list, tag, and remove images. Commands such as docker images, docker tag, and docker rmi are used for image management.
Managing volumes and networks: Docker CLI commands are available for creating, listing, and deleting volumes and networks that are used by containers. For example, docker volume create, docker volume ls, docker network create, and docker network rm are used for managing volumes and networks.
Viewing container logs and executing commands within containers: The Docker CLI allows you to view the logs generated by containers using docker logs, and to execute commands inside running containers using docker exec.
docker build
docker run
docker create
Example
docker exec
Example
docker start
docker stop
docker ps
Example
docker images
docker rmi
docker-compose commands