{"id":8549,"date":"2022-02-04T15:27:49","date_gmt":"2022-02-04T20:27:49","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=8549"},"modified":"2022-02-04T15:50:59","modified_gmt":"2022-02-04T20:50:59","slug":"building-a-docker-image-without-internet-access-kinda","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=8549","title":{"rendered":"Building a Docker Image Without Internet Access (kinda)"},"content":{"rendered":"<p>We&#8217;ve been moving a bunch of servers into magic cloudy land. A move which comes with a whole lot of additional security restrictions (and accompanying marketing that the cloud is so much more secure &#8230; uhh, no &#8230; any host to which you used a keylogged jump server to access &amp; it had absolutely no access to the internal or external network without a specific request and firewall rule would be equally secure. You just haven&#8217;t bothered with all of those controls before!). As such, we cannot just pull an image from Docker Hub. We also cannot just use apt-get to install\/update packages.<\/p>\n<p>So &#8230; how can you build a Docker image with updated software for use on these locked down boxes? Bit of a trick question &#8212; you cannot. You <em>can, <\/em>however, build such an image <em>elsewhere<\/em> and then export\/import the image.<\/p>\n<p>Build the image using your Dockerfile<\/p>\n<p><strong>docker build -t my_app_base .<\/strong><\/p>\n<p>Then export the image you created<\/p>\n<p><strong>docker save my_api_base | gzip &gt; myapp_image.tar.gz<\/strong><\/p>\n<p>Download the TGZ file and transfer it to your restricted-access host. Then import the image<\/p>\n<p><strong>docker load &lt; myapp_image.tar.gz<\/strong><\/p>\n<p>Verify the image loaded successfully<\/p>\n<pre>[user@server ~]$ docker images\r\nREPOSITORY\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TAG\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 IMAGE ID\u00a0\u00a0\u00a0\u00a0\u00a0 CREATED\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SIZE\r\nlocalhost\/my_app_base\u00a0 latest\u00a0\u00a0\u00a0\u00a0\u00a0 5z8e35z99d5z\u00a0 19 minutes ago\u00a0\u00a0\u00a0\u00a0 995 MB\r\n&lt;none&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;none&gt;\u00a0\u00a0\u00a0\u00a0\u00a05zdbcfz6393z\u00a0 About an hour ago\u00a0 1.01 GB\r\n<\/pre>\n<p>Now use docker run with your my_app_base:latest image to create a running container based on the image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve been moving a bunch of servers into magic cloudy land. A move which comes with a whole lot of additional security restrictions (and accompanying marketing that the cloud is so much more secure &#8230; uhh, no &#8230; any host to which you used a keylogged jump server to access &amp; it had absolutely no &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[623],"tags":[231],"class_list":["post-8549","post","type-post","status-publish","format-standard","hentry","category-containerized-development-and-deployment","tag-docker"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8549"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8549\/revisions"}],"predecessor-version":[{"id":8552,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/8549\/revisions\/8552"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}