Docker : Pull The Latest CentOS Image Into A Ubuntu Server

The beauty of Docker is that you can run a very lightweight image of another Linux distro on your host system.  In this post we will be pulling the latest image of CentOS into our docker container on our Ubuntu server.

Step-by-Step:

1. Open the terminal in Ubuntu, then make sure docker is running by typing service docker status, you should see something a message like the image below










2.  Type in the following command docker run --name test -it centos /bin/bash . The command tells Ubuntu to run docker with the name dev in interactive mode with an emulated terminal using the CentOS image with the bash shell.  If there's no local image docker will pull the latest image from CentOS


3.  After the command is completed you will running inside the CentOS container, you can tell by the changes in the prompt


4.  The weird number is in the prompt is the image ID of the CentOS image that we pulled.  If you type service docker status you will get an error message saying it does not recognize the command because docker is installed in the host machine not the CentOS image








5.  To get out of the CentOS container just type exit and you will get back to the host system

Comments

  1. How to format comments outside of CentOS? Use HTML or _markdown_ or what?

    ReplyDelete

Post a Comment

Popular posts from this blog

SQL: GROUP BY And HAVING

Installing AdventureWorks Sample Databases from Microsoft