Docker - (01) - Day 33
Table of contents
Docker:
Docker is a platform and tool that enables you to develop, deploy, and run applications inside containers.
Containers are lightweight, standalone, and executable software packages that include everything needed to run a piece of software, including the code, runtime, system tools, system libraries, and settings.
Container contains:
Application/webserver Software
Minimal OS
Dependency Libraries and Binaries
Application Code
Supported configuration data
You can see Docker architecture in below picture:
Docker installation
Create a new ec2 instance. I have used Amazon-Linux-image as AMI and my instance name is: builder-server
Install docker over there
command to install docker :
yum install docker -y
check the docker service status
Start docker service
๐Tasks
As you have already installed Docker through the above steps, now is the time to run Docker commands.
Use the
docker run
command to start a new container and interact with it through the command line.docker run hello-world
Use the
docker inspect
command to view detailed information about a container or image.
-To see all the running containers the command is: docker ps -a
-We can use the inspect command to get low-level configuration information about various Docker objects like images, containers, volumes, networks, nodes, etc.
To see, for example, on which node a container is deployed or what ports it listens to.
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.docker stats
command is used to see live stream a container's runtime metrics*. The command supports CPU, memory usage, memory limit, and network IO metrics.*Use the
docker top
command to view the processes running inside a container.
docker top <container ID >
command allows users to display the ps output for the main process of a given container ID or name.Use the
docker save
command to save an image to a tar archive.Copy
Copy
docker save -o OUTPUT_FILE IMAGE_NAME:TAG
Use the
docker load
command to load an image from a tar archive.Copy
Copy
docker load --input fedora.tar Loaded image: fedora:rawhide Loaded image: fedora:20
These tasks involve simple operations that can be used to manage images and containers.