{"id":7587,"date":"2018-06-16T18:59:56","date_gmt":"2018-06-16T10:59:56","guid":{"rendered":"http:\/\/rmohan.com\/?p=7587"},"modified":"2018-06-16T18:59:56","modified_gmt":"2018-06-16T10:59:56","slug":"centos-7-installs-docker-application-container-engine","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7587","title":{"rendered":"CentOS 7 Installs Docker Application Container Engine"},"content":{"rendered":"<div id=\"li_all\">\n<div id=\"li_2\"><\/div>\n<\/div>\n<div id=\"content\">\n<p>Docker is an open source application container engine based on the\u00a0\u00a0<a href=\"https:\/\/golang.org\/\" target=\"_blank\" rel=\"noopener\">Go language<\/a>\u00a0\u00a0and open sourced under the Apache 2.0 protocol.<\/p>\n<p>Docker allows developers to package their applications and dependencies into a lightweight, portable container that can then be published to any popular Linux machine or virtualized.<\/p>\n<p>Containers are completely sandboxed and do not have any interfaces with each other (similar to the iPhone&#8217;s app). More importantly, the container&#8217;s performance overhead is extremely low.<\/p>\n<h3>Docker application scenarios<\/h3>\n<ul>\n<li>Web application automation packaged and released.<\/li>\n<li>Automated testing and continuous integration, release.<\/li>\n<li>Deploy and tune databases or other back-end applications in a service-oriented environment.<\/li>\n<li>Build or extend your existing OpenShift or Cloud Foundry platform from scratch to build your own PaaS environment.<\/li>\n<\/ul>\n<h3>Docker advantages<\/h3>\n<ul>\n<li><strong>1, simplify the program:<\/strong><\/li>\n<\/ul>\n<p>Docker allows developers to package their applications and dependencies into a portable container and then publish it to any popular Linux machine for virtualization.\u00a0Docker has changed the way of virtualization so that developers can directly put their own results into Docker for management.\u00a0Convenience is already Docker&#8217;s biggest advantage. In the past, it took days or even weeks to complete the task, and it took only a few seconds to finish in the Docker container.<\/p>\n<ul>\n<li class=\"_mce_tagged_br\"><strong>2. Avoid phobias:<\/strong><\/li>\n<\/ul>\n<p class=\"_mce_tagged_br\">If you have phobia, you are still a senior patient.\u00a0Docker helps you pack your tangle!\u00a0Such as the Docker image; Docker image contains the operating environment and configuration, so Docker can simplify the deployment of a variety of application examples work.\u00a0For example, Web applications, background applications, database applications, big data applications such as\u00a0<a title=\"Hadoop\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=13\" target=\"_blank\" rel=\"noopener\">Hadoop<\/a>\u00a0clusters, message queues, and so on can all be packaged into a single mirrored deployment.<\/p>\n<ul>\n<li><strong>3, save expenses:<\/strong><\/li>\n<\/ul>\n<p>On the one hand, the arrival of cloud computing era, so that developers do not have to configure high hardware for the pursuit of effect, Docker changed the mindset of high performance inevitable high prices.\u00a0The combination of Docker and cloud makes the cloud space more fully utilized.\u00a0Not only solved the problem of hardware management, but also changed the way of virtualization.<\/p>\n<h3>1.Docker&#8217;s installation:<\/h3>\n<p>Docker supports the following\u00a0<a title=\"CentOS\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\" rel=\"noopener\">CentOS<\/a>\u00a0versions:<\/p>\n<ul>\n<li>CentOS 7 (64-bit)<\/li>\n<li>CentOS 6.5 (64-bit) or later<\/li>\n<\/ul>\n<h3>1.2 Prerequisites<\/h3>\n<p>Currently, Docker is supported by kernels in the CentOS distribution only.<\/p>\n<p>Docker runs on CentOS 7 and requires a 64-bit system with a 3.10 or higher kernel version.<\/p>\n<p>Docker runs on CentOS-6.5 or higher versions of CentOS. It requires a 64-bit system with a kernel version of 2.6.32-431 or higher.<\/p>\n<\/div>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969461.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7588\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969461.png\" alt=\"\" width=\"369\" height=\"52\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969461.png 369w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969461-300x42.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969461-150x21.png 150w\" sizes=\"(max-width: 369px) 100vw, 369px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>My operating system version:<\/p>\n<p>Centos7 officially installs docker CE instructions: https:\/\/docs.docker.com\/install\/linux\/docker-ce\/centos\/<\/p>\n<p>Docker packages and dependencies are included in the default CentOS-Extras source. You can update the yum source to install yum install, or you can choose to download the rpm package.<\/p>\n<p>The official download address: https:\/\/download.docker.com\/linux\/centos\/7\/x86_64\/stable\/Packages\/<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969462.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7589\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969462.png\" alt=\"\" width=\"854\" height=\"365\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969462.png 854w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969462-300x128.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969462-768x328.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969462-150x64.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969462-400x171.png 400w\" sizes=\"(max-width: 854px) 100vw, 854px\" \/><\/a><\/p>\n<h3><span>1.3 Use wget command to download rpm package<\/span><\/h3>\n<p><span>Create a downloads folder and use the wget command to download<\/span><\/p>\n<p><span>[root@sungeek downloads]# wget https:\/\/download.docker.com\/linux\/centos\/7\/x86_64\/stable\/Packages\/docker-ce-18.03.1.ce-1.el7.centos.x86_64.rpm\u00a0<\/span><br \/>\n<span>[ Root@sungeek downloads]# yum install docker-ce-18.03.0.ce-1.el7.centos.x86_64.rpm<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969463.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7590\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969463.png\" alt=\"\" width=\"920\" height=\"127\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969463.png 920w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969463-300x41.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969463-768x106.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969463-150x21.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969463-400x55.png 400w\" sizes=\"(max-width: 920px) 100vw, 920px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span>1.4 Use yun install to install directly<\/span><\/h3>\n<p><span>I use yum update to update the yum source and install yum install<\/span><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969464.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7591\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969464.png\" alt=\"\" width=\"695\" height=\"207\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969464.png 695w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969464-300x89.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969464-150x45.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969464-400x119.png 400w\" sizes=\"(max-width: 695px) 100vw, 695px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>[root@rmohan downloads]# yum update<br \/>\n[root@rmohan downloads]# yum -y install docker-io<br \/>\n[root@localhost downloads]# docker &#8211;version &#8211;View the version, preferably using wget, so you can find the corresponding The latest installation package<br \/>\nDocker version 1.13.1, build 94f4240\/1.13.1<\/p>\n<p>1.5 Start the Docker Process<br \/>\n[root@localhost downloads]# systemctl start docker<br \/>\n[root@localhost downloads]# systemctl status docker<br \/>\n[root@localhost downloads]# systemctl enable docker &#8211;Set boot self-booting docker service<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969465.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7592\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969465.png\" alt=\"\" width=\"928\" height=\"434\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969465.png 928w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969465-300x140.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969465-768x359.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969465-150x70.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969465-400x187.png 400w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><\/p>\n<h3><span>1.6 Verifying Successful Installation<\/span><\/h3>\n<p><span>Enter docker directly to list the usage of this command<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969466.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7593\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969466.png\" alt=\"\" width=\"920\" height=\"589\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969466.png 920w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969466-300x192.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969466-768x492.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969466-150x96.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969466-400x256.png 400w\" sizes=\"(max-width: 920px) 100vw, 920px\" \/><\/a><\/p>\n<p><span>Test Run First Container: hello-world<\/span><\/p>\n<p><span>Since there is no hello-world image locally, a hello-world image will be downloaded and run inside the container.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969467.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7594\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969467.png\" alt=\"\" width=\"795\" height=\"544\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969467.png 795w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969467-300x205.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969467-768x526.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969467-150x103.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969467-400x274.png 400w\" sizes=\"(max-width: 795px) 100vw, 795px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3><span>2. The most commonly used commands<\/span><\/h3>\n<h4><span>2.1 Use docker images to view images<\/span><\/h4>\n<p><span>[root@localhost downloads]# docker images\u00a0<\/span><br \/>\n<span>REPOSITORY TAG IMAGE ID CREATED SIZE\u00a0<\/span><br \/>\n<span>docker.io\/hello-world latest e38bc07ac18e 2 months ago 1.85 kB<\/span><\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969468.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7595\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969468.png\" alt=\"\" width=\"922\" height=\"83\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969468.png 922w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969468-300x27.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969468-768x69.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969468-150x14.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969468-400x36.png 400w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/a><\/p>\n<p><span>Docker ps is also the most commonly used command,\u00a0<\/span><strong><span>-a :<\/span><\/strong><span>\u00a0displays all containers, including those that are not running.<\/span><\/p>\n<h4><span>2.3 Use docker logs to view the container console output<\/span><\/h4>\n<p><span>Get the container&#8217;s log<\/span><\/p>\n<p class=\"console\"><span>Docker logs [container]<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969469.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7596\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/180614091969469.png\" alt=\"\" width=\"1149\" height=\"91\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469.png 1149w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469-300x24.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469-768x61.png 768w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469-1024x81.png 1024w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469-150x12.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/180614091969469-400x32.png 400w\" sizes=\"(max-width: 1149px) 100vw, 1149px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/1806140919694610.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-7597\" src=\"http:\/\/rmohan.com\/wp-content\/uploads\/2018\/06\/1806140919694610.png\" alt=\"\" width=\"644\" height=\"226\" srcset=\"https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/1806140919694610.png 644w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/1806140919694610-300x105.png 300w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/1806140919694610-150x53.png 150w, https:\/\/mohan.sg\/wp-content\/uploads\/2018\/06\/1806140919694610-400x140.png 400w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<p>Docker is an open source application container engine based on the Go language and open sourced under the Apache 2.0 protocol.<\/p>\n<p>Docker allows developers to package their applications and dependencies into a lightweight, portable container that can then be published to any popular Linux machine or virtualized.<\/p>\n<p>Containers are completely sandboxed and do not [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7587"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7587"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7587\/revisions"}],"predecessor-version":[{"id":7598,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7587\/revisions\/7598"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}