{"id":1958,"date":"2017-08-24T17:27:34","date_gmt":"2017-08-24T22:27:34","guid":{"rendered":"http:\/\/osric.com\/chris\/accidental-developer\/?p=1958"},"modified":"2017-08-24T17:27:34","modified_gmt":"2017-08-24T22:27:34","slug":"using-a-dockerfile-to-modify-a-container","status":"publish","type":"post","link":"https:\/\/osric.com\/chris\/accidental-developer\/2017\/08\/using-a-dockerfile-to-modify-a-container\/","title":{"rendered":"Using a Dockerfile to modify a container"},"content":{"rendered":"<p>In the <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2017\/08\/running-centos-in-a-docker-container\/\">previous post<\/a> I modified a CentOS Docker container image to include the <code>man<\/code> application as a simple example. But it was not obvious looking at the container what modifications, if any, had been made. I wanted instead to specify the installation of <code>man<\/code> via a Dockerfile so that the modifications to the base OS would be more clear to another user.<\/p>\n<p>First, I create a new empty directory and create a Dockerfile within the directory:<\/p>\n<p><code>$ mkdir man-centos<br \/>\n$ cd man-centos<br \/>\n$ vi Dockerfile<\/code><\/p>\n<p>In the Dockerfile, I specify that I want to use the publicly-available CentOS 7 base image, and then install the man package via yum:<\/p>\n<p><code># Start with CentOS 7<br \/>\nFROM centos:7<\/p>\n<p># Install the man yum module<br \/>\nRUN yum -y install man<\/code><\/p>\n<p>Then build and run the container:<\/p>\n<p><code>$ docker build -t man-centos .<br \/>\n$ docker run -i -t man-centos<br \/>\n[root@6f597c97d72d \/]# man man<br \/>\nNo manual entry for man<\/code><\/p>\n<p>It works!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous post I modified a CentOS Docker container image to include the man application as a simple example. But it was not obvious looking at the container what modifications, if any, had been made. I wanted instead to specify the installation of man via a Dockerfile so that the modifications to the base &hellip; <a href=\"https:\/\/osric.com\/chris\/accidental-developer\/2017\/08\/using-a-dockerfile-to-modify-a-container\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Using a Dockerfile to modify a container<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[451],"tags":[414,449],"class_list":["post-1958","post","type-post","status-publish","format-standard","hentry","category-docker","tag-centos","tag-docker"],"_links":{"self":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/comments?post=1958"}],"version-history":[{"count":6,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1958\/revisions"}],"predecessor-version":[{"id":1968,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/posts\/1958\/revisions\/1968"}],"wp:attachment":[{"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/media?parent=1958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/categories?post=1958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/osric.com\/chris\/accidental-developer\/wp-json\/wp\/v2\/tags?post=1958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}