Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Docker Image in DevOps

In Docker, everything is based on Images. An image is combination of a file system and parameters. Let's take an example of the following command in Docker.
          docker run hello-world

The Docker command is specific and tells the Docker program on the Operating System that something needs to be done.

Now let's at how we can use the CentOS image available in Docker Hub to run CentOS on our Ubuntu machine. We can do this by executing the following command on our Ubuntu machine -
      sudo docker run centos -it/bin/bash

Here, centos is the name of the following we want to download from Docker Hub and install on our Ubuntu machine. 


Displaying Docker Images :

The following command displays the list images on the system:      docker images

Return Value
The output will provide the list of images on the system.

Example :
   sudo docker images

Output 
 When we run the above command, it will produce the following result -

Here you can see that the server three images : centos, newcentos, and jenkins. Each image has the following attributes -
  • TAG
  • Image ID
  • Created
  • Virtual Size
Downloading Docker Image :

Image can be downloaded from Docker Hub using the Docker run command 

Syntax
  The following syntax is used to run a command in a Docker container docker run image

Options

Image

The output will run the command in the desired container.
Example
     sudo docker run centos

The command will download the centos image, if it is not already present, and run the OS as a container.

Output
  When we run the above command, we will get the following result -


Removing Docker Images :

The Docker images on the system can be removed via the docker rmi command. Let's look at this command in more detail.
   docker rmi

The command is used to remove Docker images

Syntax
   docker rmi ImageID

Options
ImageID - This is the ID of the image which needs to be removed.

Return Value
  The output will provide the Image ID of the deleted Image.

Example
  sudo docker rmi 7a86f7ffcb25

Here, 7a86f7ffcb25 is the Image ID of the newcentos image.

Output
  When we run the above command, it will produce the following result -

No comments:

Post a Comment

Popular Articles