Simple Docker commands.
This is Day 16 Task:
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:
Use the
docker run
command to start a new container and interact with it through the command line.Use the
docker inspect
command to view detailed information about a container or image.Use the
docker port
command to list the port mappings for a container.Use the
docker stats
command to view resource usage statistics for one or more containers.Use the
docker top
command to view the processes running inside a container.Use the
docker save
command to save an image to a tar archive.Use the
docker load
command to load an image from a tar archive.
docker run:
First, pull hello-world "docker pull hello-world" and run it using "docker run hello-world"
We pulled and hello-world image from Docker Hub and Ran it.
docker inspect:
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.
Information like Volumes attached , container restarts, creation time , etc are provided.
command : docker inspect <container name>/<container id>
docker port
While running a container you give them a port(docker run -p 80:80 nginx) to access the container from outside so to know the port of the running container you give this command.
docker port <image ID>
docker stats
Is used to view resource usage statistics for one or more containers.Gives CPU Usage, memory usage, etc. in real-time.
command : docker stats --all/<container ID>
output:
docker top
gives the processes running inside a container.
command: docker top <container ID>
docker save
The docker image save command is used to Save one or more images to standard output, or to a tar archive.
To save the images to a tar archive, you can use the -o option.
You can save multiple images to the same tar archive, separating each image with space The images can be extracted with the docker image load command
command: docker save -o "new.tar" "your Image name".
\>> here -o \= output
Multiple images can be zipped by just giving space between images.
docker load
This command is used to load(extract) the images in .tar file.
command: docker load -i yourfile.tar
\>> here -i \= imageHope you like this blog. You can follow me for more blogs like this.....
Thank you.