Docker for DevOps Engineers
Docker
Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
Tasks
1)Use the docker run command to start a new container and interact with it through the command line.
The “docker run” command is used to start a new container from an image.
For example, to start a new container from the “hello-world” image and interact with it through the command line, you can run the following command:
docker run hello-world
2)Use the docker inspect command to view detailed information about a container or image.
docker inspect is a command that returns detailed, low-level information on Docker objects. Those objects can be docker images, containers, networks, volumes, plugins, etc. By default, docker inspect returns information in JSON format.
3)Use the docker port command to list the port mappings for a container.
The “docker port” command is used to list the port mappings for a container.
command - docker port <container-name>
4)Use the docker stats command to view resource usage statistics for one or more containers.
docker stats : The docker stats command returns a live data stream for running containers. To limit data to one or more specific containers, specify a list of container names or ids separated by a space. You can specify a stopped container but stopped containers do not return any data.
Command - docker stats Container_ID
5)Use the docker top command to view the processes running inside a container.
docker top : Display the running processes of a container.
command : docker top <container>
6)Use the docker save command to save an image to a tar archive and then use the docker load command to load an image from a tar archive.
docker save : Save one or more images to a tar archive
command : docker save [options] [image]
option: --output , -o : Write to a file, instead of STDOUT
7)Use the docker load command to load an image from a tar archive.
command : docker load [options]
options:
--input , -i : Read from tar archive file, instead of STDIN
--quiet , -q : Suppress the load output
This will load the image from the specified tar archive file and add it to your local image repository.
Thank You for reading!!