How to download and remove Docker Image and use Docker container on CentOS and RHEL 6/7 and Ubuntu 16.04 step by step guide


Download Docker Image from the Docker Hub and Docker Remove Image | In this article we will learn how to download docker image and after downloading the image start and run docker container and play with docker container to run and deploy an application and how to remove docker image.

How to download Docker Image

We can download Docker Image from the Docker Hub on your linux system using the below command. Suppose we are going to download centos image first we need to search the available images into the central docker repo using the below command.

[root@localhost ~]# docker search centos
How to download Docker Image and use Docker container on CentOS and RHEL 6/7 step by step guide,Docker Remove Image,Docker Hub
How to download Docker Image and use Docker container on CentOS and RHEL 6/7 step by step guide

Once getting the available images we can download the image using the below command.

[root@localhost ~]# docker pull centos
latest: Pulling from centos
e4b082fc6cdb: Pull complete
f016d310caa9: Pull complete
ab9a80ab07d0: Pull complete
Digest: sha256:38777a4106f0072649128ea4236241345a3ed21c55abbbd53bad5342549f6126
Status: Downloaded newer image for centos:latest

To list the available docker images we can execute the below command.

 [root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              latest              ab9a80ab07d0        6 weeks ago         201.8 MB


Docker Remove Image

If you want to remove docker image you can execute the below command.

[root@localhost ~]# docker rmi centos

If you want to remove docker image force fully then you need to use the below command.

[root@localhost ~]# docker rmi -f ab9a80ab07d0

How To Use Docker Container

 After downloaded the image we can start and run the docker container.  We can run the container using the below command. In this below command run the container using the downloaded image and get the downloaded centos release version.

[root@localhost ~]# docker run centos cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)

After running the docker container we need to know container id which is very useful to start and stop the container as well as you can use container name also to start and stop the container.

[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED              STATUS                          PORTS               NAMES
a4d4d2937780        centos              "cat /etc/centos-rel   About a minute ago   Exited (0) About a minute ago                       sick_yalow

And you can start the container again using the below command.
[root@localhost ~]# docker start <container ID>

How To Run interactive session for docker container

To run interactive session for a docker container we can use the below command.

[root@localhost ~]# docker run –it centos bash

If you type exit into the shell the container will be stop and if you don’t want to stop container process you can press ctrl+p and ctrl+q at a time.

You can attach the container using the below command

[root@localhost ~]# docker attach <container id>

You can check the container process using the below command.

[root@localhost ~]# docker ps

That’s all.If this article is helpful to know about Download Docker Image from the Docker Hub and Docker Remove Image please share it!




Please Donate To Bitcoin Address: [[address]]
Donation of [[value]] BTC Received. Thank You.
[[error]]
SHARE

Admin

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

2 comments:

  1. Useful information.I am actual blessed to read this article.thanks for giving us this advantageous information.I acknowledge this post.and I would like bookmark this post.Thanks

    oracle training in chennai

    oracle training in omr

    oracle dba training in chennai

    oracle dba training in omr

    ccna training in chennai

    ccna training in omr

    seo training in chennai

    seo training in omr

    ReplyDelete
  2. .I like the helpful info you supply in your articles. I’ll bookmark your weblog and take a look at once more here regularly. I am relatively certain I will learn a lot of new stuff right here! Good luck for the following!
    oracle training in chennai

    oracle training in velachery

    oracle dba training in chennai

    oracle dba training in velachery

    ccna training in chennai

    ccna training in velachery

    seo training in chennai

    seo training in velachery

    ReplyDelete