{"id":18149,"date":"2023-02-03T10:01:50","date_gmt":"2023-02-03T16:01:50","guid":{"rendered":"https:\/\/threecloud.wpengine.com\/?p=18149"},"modified":"2023-02-03T10:18:48","modified_gmt":"2023-02-03T16:18:48","slug":"azure-ssh-for-docker-web-server-images","status":"publish","type":"post","link":"https:\/\/3cloudsolutions.com\/resources\/azure-ssh-for-docker-web-server-images\/","title":{"rendered":"Azure SSH for Docker Web Server Images"},"content":{"rendered":"<h3>Issue<\/h3>\n<p>This article is for those that have found issues when implementing Azure SSH involving a Docker web server image. One of the primary indications that Azure SSH may be conflicting with your application server startup is the ability to only start one or the other.<\/p>\n<h3>Example<\/h3>\n<p>When searching through most web server images, an execution command can be typically found. For example, if php:8.1-apache-buster was used as the base image of the custom Dockerfile:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-18150\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727.png\" alt=\"\" width=\"714\" height=\"48\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727.png 1255w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-300x20.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-1024x69.png 1024w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-768x52.png 768w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-600x41.png 600w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-992x67.png 992w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-1200x81.png 1200w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094727-60x4.png 60w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/p>\n<p>The following command can be seen layered within the Dockerfile, which starts a script to run the web server:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-18151\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094845.png\" alt=\"\" width=\"377\" height=\"53\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094845.png 687w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094845-300x42.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094845-600x85.png 600w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-094845-60x8.png 60w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<h3>Solution<\/h3>\n<p>A Dockerfile will only execute the last CMD operation even when the CMD is layered within the image. To start both servers, configure the SSH in accordance with the following Microsoft documentation: <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/app-service\/configure-custom-container?tabs=debian&amp;pivots=container-linux\">https:\/\/learn.microsoft.com\/<\/a>. After the configuration is complete, edit the entrypoint.sh file and add the web server start command under the \u2018service ssh start\u2019:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-18152\" src=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313.png\" alt=\"\" width=\"515\" height=\"156\" srcset=\"https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313.png 1030w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-300x91.png 300w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-1024x310.png 1024w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-768x233.png 768w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-600x182.png 600w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-992x300.png 992w, https:\/\/3cloudsolutions.com\/wp-content\/uploads\/2023\/02\/Screenshot-2023-02-03-095313-60x18.png 60w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" \/><\/p>\n<p>The \u2018service apache2 start\u2019 should be replaced with the execution command appropriate to the webserver image.<\/p>\n<p>In an engagement with a client, the \u2018gunicorn\u2019 command was not used but still worked as intended.<\/p>\n<h3>Summary<\/h3>\n<p>The \u2018run SSH\u2019 server command may be stopping the \u2018start web server\u2019 command. A potential fix may be to create a script that starts both servers to ensure they are running together. There can only be one CMD command in a Dockerfile.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Issue This article is for those that have found issues when implementing Azure SSH involving&mldr;<\/p>\n","protected":false},"author":98,"featured_media":18153,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[290,354],"tags":[360],"class_list":["post-18149","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-platform","category-infrastructure-cloud-platform","tag-apache","topics-blog"],"acf":[],"_links":{"self":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/18149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/users\/98"}],"replies":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/comments?post=18149"}],"version-history":[{"count":0,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/posts\/18149\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media\/18153"}],"wp:attachment":[{"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/media?parent=18149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/categories?post=18149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3cloudsolutions.com\/wp-json\/wp\/v2\/tags?post=18149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}