{"id":2987,"date":"2020-07-30T10:16:00","date_gmt":"2020-07-30T08:16:00","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/uncategorized\/run-docker-image-on-microsoft-azure\/"},"modified":"2022-01-05T20:05:29","modified_gmt":"2022-01-05T19:05:29","slug":"run-docker-image-on-microsoft-azure","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/","title":{"rendered":"Running Docker images on Microsoft Azure"},"content":{"rendered":"\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-f8694ea5      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#introducing-docker\" class=\"uagb-toc-link__trigger\">Introducing Docker<\/a><li class=\"uagb-toc__list\"><a href=\"#docker-installation\" class=\"uagb-toc-link__trigger\">Docker installation<\/a><li class=\"uagb-toc__list\"><a href=\"#create-a-docker-image\" class=\"uagb-toc-link__trigger\">Create a Docker image<\/a><li class=\"uagb-toc__list\"><a href=\"#start-the-image-on-an-azure-web-app\" class=\"uagb-toc-link__trigger\">Start the image on an Azure Web App<\/a><li class=\"uagb-toc__list\"><a href=\"#start-the-image-on-an-azure-container-instance\" class=\"uagb-toc-link__trigger\">Start the image on an Azure Container Instance<\/a><li class=\"uagb-toc__list\"><a href=\"#advanced-scenarios\" class=\"uagb-toc-link__trigger\">Advanced scenarios<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<p class=\" eplus-bmT88L\">In a <a href=\"https:\/\/www.codemotion.com\/magazine\/author\/antonio-turibbio-liccardi\/\">previous article<\/a>, we discussed how to create a new <span id=\"urn:enhancement-f33f4730\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/web_application\">web app<\/span> and deploy it to an Azure <span id=\"urn:enhancement-f77befdc\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/web_application\">Web App<\/span> instance. This article goes a step further, creating a <span id=\"urn:enhancement-b7bd22f3\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> image for the <span id=\"urn:enhancement-3845da94\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/web_application\">web app<\/span> in order to have more flexibility in management and deployment.<\/p>\n\n\n\n<h2 class=\"eplus-8WYfB7 wp-block-heading\" id=\"7set3\">Introducing Docker<\/h2>\n\n\n\n<p class=\" eplus-DO2G6C\">Fast-growing business organizations have to deploy new <span id=\"urn:batch-analysis-2c15137b-af4d-4dea-a7d6-d51c95d83b42\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/feature_machine_learning\">features<\/span> of their <span id=\"urn:enhancement-55363b33\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> rapidly if they want to stay on top of the market.<\/p>\n\n\n\n<p class=\" eplus-llLMUh\">Deploying an <span id=\"urn:enhancement-92fea73e\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> is not always an easy task; how difficult it is depends primarily on how the <span id=\"urn:enhancement-82619a9a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> is structured and what <span id=\"urn:enhancement-4340d51f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tool\">tools<\/span> or <span id=\"urn:enhancement-2ef10e40\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_deployment\">deployment<\/span> patterns have been used.<\/p>\n\n\n\n<p class=\" eplus-tTnS0W\">In recent years, the rise of <span id=\"urn:enhancement-710b5d9c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> technologies has changed the game: <span id=\"urn:batch-analysis-98570eca-392c-4224-8eb0-df02a0a16d70\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/complexity\">complex<\/span> issues related to provisioning <span id=\"urn:enhancement-5c45d77c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/infrastructure\">infrastructures<\/span> and software installation dependencies have faded into the background.<\/p>\n\n\n\n<p class=\" eplus-vuFiLR\">There are lots of benefits to <span id=\"urn:enhancement-fe895e1f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_application_development\">using<\/span> container technologies:<\/p>\n\n\n\n<ul class=\"eplus-Picryg wp-block-list\"><li>Reduced deployment time;<\/li><li>Simple host <span id=\"urn:enhancement-24476190\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">configuration<\/span>;<\/li><li>Multiple apps can run at the same time <span id=\"urn:enhancement-a1076a7a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_application_development\">using<\/span> different containers;<\/li><li>Quick <strong>scaling<\/strong>;<\/li><li>Savings in infrastructure <strong>costs<\/strong>;<\/li><li>Containers are based on images, which are simple to create and manage;<\/li><li>Containers share the same hardware resources but maintain <strong>isolation<\/strong> between them.<\/li><\/ul>\n\n\n\n<p class=\" eplus-luxuQ9\">Many people prefer using <span id=\"urn:enhancement-c91bf324\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> for development (with an isolated environment) or for complex distributed architecture such as <span id=\"urn:enhancement-56e9679c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microservices_2\">Microservices<\/span>. Containers differ from <span id=\"urn:batch-analysis-9e06b1dc-d997-4a3b-9cea-1b9b65419ee6\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/virtual_machine\">Virtual Machines<\/span>, in that thy offer quick startup and share the <span id=\"urn:enhancement-6e3e0b05\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/resource\">resources<\/span> of the host (avoiding unauthorized access between one <span id=\"urn:enhancement-17947c2f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> and another). On the other hand, containers don&#8217;t offer the same <span id=\"urn:enhancement-b7c0b395\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_hardware\">hardware<\/span> isolation as <span id=\"urn:batch-analysis-01f1b242-b111-4b2b-9587-b55e2c2cdd8b\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/virtual_machine\">Virtual Machines<\/span>. Indeed, <span id=\"urn:enhancement-a3e49f44\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/security\">security<\/span> can be a reason for blocking the adoption of this method, since containers share the host operating system.<\/p>\n\n\n\n<p class=\" eplus-Gw69Ms\"><strong><span id=\"urn:enhancement-c8301e2a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span><\/strong>, a <span id=\"urn:enhancement-bf833ce4\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/company\">company<\/span> founded by <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/www.crunchbase.com\/person\/solomon-hykes#section-overview\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Solomon Hykes<\/a>, has prevailed among the various <span id=\"urn:enhancement-a3d26381\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> technologies thanks to its complete, ready-to-use ecosystem. With this in place, it is possible to create and distribute an <span id=\"urn:enhancement-cf27eef9\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> and execute it either on-premises or in cloud environments. Specifically, the <span id=\"urn:enhancement-58a198\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> is compiled into an image using the <strong><span id=\"urn:enhancement-4cba596\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> <span id=\"urn:enhancement-6476fe65\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command-line_interface\">CLI<\/span><\/strong>: starting from a base image with a specific <span id=\"urn:batch-analysis-3c58e210-09b8-4612-8bfa-e9ae4781b6da\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/operating_system\">operating system<\/span> (i.e., <span id=\"urn:batch-analysis-60d03b95-667b-4742-8863-7656d690eace\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/linux\">Linux<\/span> or <span id=\"urn:enhancement-7d1c0061\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_windows\">Windows<\/span>), <span id=\"urn:enhancement-fcefe368\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> creates an image which comprises both the <span id=\"urn:enhancement-e097bd27\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> and the execution environment. The compiled image is then stored in a local or remote <span id=\"urn:enhancement-fbe05bbb\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_repository\">repository<\/span> from which it can be downloaded and started. <span id=\"urn:enhancement-ac37f51b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> also offers a cloud subscription to <a href=\"https:\/\/hub.docker.com\/\">DockerHub<\/a>, which supplies build and collaboration tools to facilitate cloud and container technology adoption.<\/p>\n\n\n\n<h2 class=\"eplus-rg7aDF wp-block-heading\" id=\"8p1p0\">Docker installation<\/h2>\n\n\n\n<p class=\" eplus-bQ0jKI\">To use <span id=\"urn:enhancement-a1decf59\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span>, you need to install the <span id=\"urn:enhancement-a1bce756\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> Engine on a <span id=\"urn:enhancement-59f849\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_developer\">developer<\/span> machine: this <a href=\"https:\/\/docs.docker.com\/install\/\">page<\/a> offers a list of supported platforms and the steps required to set up your environment. Note that <span id=\"urn:enhancement-5459d499\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/installation_computer_programs\">installation<\/span> requires a <span id=\"urn:enhancement-17a7408d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> Login <span id=\"urn:enhancement-511b42c2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">account<\/span>.<\/p>\n\n\n\n<p class=\" eplus-8ODsRM\">After <span id=\"urn:enhancement-526c7cc6\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/installation_computer_programs\">installation<\/span>, all available <span id=\"urn:enhancement-af2699c8\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/tool\">tools<\/span>will be <span id=\"urn:enhancement-8d7961a6\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/installation_computer_programs\">installed<\/span> on your machine (stored <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/cli\/#configuration-files\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a>), such as the <span id=\"urn:enhancement-47a1d2db\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> CLI, which helps to spin up the first container using the following <span id=\"urn:enhancement-494099b1\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-XsSO2Y\">docker run hello-world<\/pre>\n\n\n\n<p class=\" eplus-PGRzZL\">The following is then displayed:<\/p>\n\n\n\n<div class=\"wp-block-image  eplus-adSq4o\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image01_8a2374a92eb333d65fd290e392ad344e_800.png\" alt=\"Docker: The first container execution\"\/><figcaption>The first container execution<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-oS0X85\"><span id=\"urn:enhancement-817a8d06\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> runs as <span id=\"urn:enhancement-1681a1c5\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/superuser\">root<\/span> <span id=\"urn:enhancement-5c87c323\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">user<\/span> by default. Unless a name is specified, <span id=\"urn:enhancement-a7a7db7e\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> will automatically assign a random name. Other useful <span id=\"urn:enhancement-b406c0e2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">commands<\/span> include:<\/p>\n\n\n\n<ul class=\"eplus-5HCd9s wp-block-list\"><li><strong><code>docker run -d image<\/code><\/strong>: run the container in background (detach mode);<\/li><li><strong><code>docker ps -a<\/code><\/strong>: get a list of containers;<\/li><li><strong><code>docker pull<\/code><\/strong>: access a specific image from a Docker Registry (private or public) and store it on the machine (more <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/pull\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">here<\/a>);<\/li><li><strong><code>docker image list<\/code><\/strong>: access available images on the local machine;<\/li><li><strong><code>docker start &lt;CONTAINER_NAME&gt;<\/code><\/strong>: starts a specific container;<\/li><li><strong><code>docker stop &lt;CONTAINER_NAME&gt;<\/code><\/strong>: stops a specific container;<\/li><li><strong><code>docker rm &lt;CONTAINER_NAME&gt;<\/code><\/strong>: deletes a container that is not in execution;<\/li><li><strong><code>docker image rm &lt;IMAGE_NAME&gt;<\/code><\/strong>: deletes a container image;<\/li><li><strong><code>docker container inspect &lt;CONTAINER&gt;<\/code><\/strong>: shows details about containers;<\/li><li><strong><code>docker image inspect &lt;IMAGE&gt;<\/code><\/strong>: shows details about images (including layers);<\/li><li><strong><code>docker volume<\/code><\/strong>: to create new data volume (more <a href=\"https:\/\/docs.docker.com\/storage\/volumes\/\">here<\/a>);<\/li><li><strong><code>docker history &lt;IMAGE&gt;<\/code><\/strong>: to see image layers;<\/li><li><strong><code>docker compose<\/code><\/strong>: to create multiple containers at the same time (more <a href=\"https:\/\/docs.docker.com\/compose\/\">here<\/a>).<\/li><\/ul>\n\n\n\n<p class=\" eplus-57FJjX\">The <strong>build<\/strong> <span id=\"urn:enhancement-47573a88\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> helps to create an image for your <span id=\"urn:enhancement-426efb27\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-pPov7V\">docker build &lt;PARAMETERS&gt;<\/pre>\n\n\n\n<h2 class=\"eplus-Z70NIW wp-block-heading\" id=\"6mhvo\">Create a Docker image<\/h2>\n\n\n\n<p class=\" eplus-iyMUnF\">This section explores the creation of a <span id=\"urn:enhancement-9779d80b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> image, starting with an example found in a previous <a href=\"https:\/\/www.codemotion.com\/magazine\/dev-hub\/cloud-manager\/a-first-web-app-on-microsoft-azure\/\">article<\/a>.<\/p>\n\n\n\n<p class=\" eplus-lfZxZ8\">A <span id=\"urn:enhancement-4195d107\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> image is simply a <span id=\"urn:enhancement-2ec7cfaf\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> composed of different layers created during the build phase. It can contain code, configuration <span id=\"urn:enhancement-ffb8c135\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">files<\/span>, libraries, and <span id=\"urn:enhancement-51b6ace6\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/environment_variable\">environment variables<\/span>. <span id=\"urn:enhancement-fcd8eee2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> images don&#8217;t contain an operating system, but rely on the OS of the host. For this reason, images are categorized by the kernel they use: Linux or <span id=\"urn:enhancement-58d0fc5c\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_windows\">Windows<\/span>. If you are using Linux, you can only run <span id=\"urn:enhancement-9c43086b\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/lxc\">Linux containers<\/span>. If you are using <span id=\"urn:enhancement-58f9ea1b\" class=\"textannotation disambiguated wl-creative-work\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_windows\">Windows<\/span>, <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/virtualization\/windowscontainers\/about\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">you can run both container types<\/a>. The <span id=\"urn:enhancement-1b2e5472\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> run <span id=\"urn:enhancement-9cd56e3a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> explained in the previous paragraph creates a new <span id=\"urn:enhancement-614d4807\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> Container.  <span id=\"urn:enhancement-9a679873\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> images are also created by a Dockerfile. A <span id=\"urn:enhancement-f4261312\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> image is an immutable artifact: it contains many read-only layers dependent on the base images or the Dockerfile definition. Layers function as the building blocks &#8211; once a container is started, it has a read\/write layer.<\/p>\n\n\n\n<h3 class=\"eplus-jDlRFQ wp-block-heading\" id=\"98ng2\">Create a Dockerfile<\/h3>\n\n\n\n<p class=\" eplus-RIKFhC\">First, you need a <strong>Dockerfile<\/strong> &#8211; a text <span id=\"urn:enhancement-7e9d4b1a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> containing a list of steps that execute sequentially during the build process.<\/p>\n\n\n\n<p class=\" eplus-6ZH3TO\">Creating a Dockerfile in<span id=\"urn:local-annotation-739058\" class=\"textannotation disambiguated\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/visual_studio_code\"> Visual Studio Code<\/span> is relatively simple; once the <a href=\"https:\/\/code.visualstudio.com\/docs\/azure\/docker#_install-the-docker-extension\" target=\"_blank\" rel=\"noopener noreferrer\">Docker Extension<\/a> is installed, the <span id=\"urn:enhancement-f2911889\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> palette helps (via a wizard) to generate a Dockerfile related to your <span id=\"urn:batch-analysis-7fe4b459-c90c-45e0-980a-f205b76d1ec2\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/project\">project<\/span>. These are the settings:<\/p>\n\n\n\n<ul class=\"eplus-IJTnCS wp-block-list\"><li><strong>Application Platform<\/strong>: ASP.NET Core<\/li><li><strong><span id=\"urn:batch-analysis-1ee1c58a-ce23-4148-a383-b7de1643a940\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/operating_system\">Operating system<\/span><\/strong>: Linux<\/li><li><strong>Port<\/strong>: 80, 443<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image  eplus-XbSLKF\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image02_d17855a793d52554a0e1f5746f83f10c_800.png\" alt=\"Add a Dockerfile\"\/><figcaption>Add a Dockerfile<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image  eplus-dCbnND\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image03_4281ea59610a33e0524cb4c29ab374c3_800.png\" alt=\"Select the Application Platform\"\/><figcaption>Select the Application Platform<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image  eplus-ok6CmZ\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image04_4980f8bd2aa48cbe268801c2a030f892_800.png\" alt=\"Select the Operating System\"\/><figcaption>Select the Operating System<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image  eplus-dkfFSv\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image05_ea755203d00d1fdac1ca3894981bab21_800.png\" alt=\"Select the listening ports\"\/><figcaption>Select the listening ports<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-NstCMe\">At the end of the wizard, Visual Studio Code will show a text <span id=\"urn:enhancement-3a28053d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> like this:<\/p>\n\n\n\n<div class=\"wp-block-image  eplus-XgZQ0h\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image06_5f84a32292d041c6e76322743dbf26ec_800.png\" alt=\"The contents of a Dockerfile\"\/><figcaption>The contents of a Dockerfile<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-jBHsCc\">This <span id=\"urn:enhancement-b7d9c84f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_file\">file<\/span> is composed of different sections starting with the FROM keyword.  These define the <strong>base image<\/strong> from which to build your image (which includes your <span id=\"urn:enhancement-285c81b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span>). A Dockerfile can contain multiple <code>FROM<\/code> statements (multi-stage builds). Other available keywords are:<\/p>\n\n\n\n<ul class=\"eplus-TXpDlK wp-block-list\"><li><strong><code>WORKDIR<\/code><\/strong>: sets the current directory during the build process;<\/li><li><strong><code>EXPOSE<\/code><\/strong>: sets the ports to listen to incoming connections at runtime;<\/li><li><strong><code>COPY<\/code><\/strong>: copies files;<\/li><li><strong><code>RUN<\/code><\/strong>: runs commands during the build;<\/li><li><strong><code>CMD<\/code><\/strong>: defines arguments for the entrypoint;<\/li><li><strong><code>ENTRYPOINT<\/code><\/strong>: is the command to run when the container starts.<\/li><\/ul>\n\n\n\n<p class=\" eplus-xh2dps\">The reason for the multiple sections in this Dockerfile is that <span id=\"urn:enhancement-7faa8d12\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> images can be built using different <span id=\"urn:enhancement-542c7dc5\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">configurations<\/span>. For example, in this Dockerfile, you can choose to use the &#8216;<strong>build<\/strong>&#8216; section instead of the &#8216;<strong>publish<\/strong>&#8216; section to compile the <span id=\"urn:enhancement-553a2351\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_software\">application<\/span> only.<\/p>\n\n\n\n<h3 class=\"eplus-ln4O6V wp-block-heading\" id=\"2ecf7\">Create a Docker image<\/h3>\n\n\n\n<p class=\" eplus-fJZcOQ\">To create the image, you can execute the following <span id=\"urn:enhancement-a6bb7f26\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> in the same directory of the Dockerfile:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-21zIQz\">docker build -t myfirstapp:v1 .<\/pre>\n\n\n\n<p class=\" eplus-hNdNac\">The &#8216;t&#8217; <span id=\"urn:enhancement-cc619b14\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/parameter\">parameter<\/span> stands for <strong>tag<\/strong>. This is a fundamental concept of <span id=\"urn:enhancement-c15fb53c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> &#8211; it helps to organize images, and is composed of the <strong>name<\/strong> and the <strong><span id=\"urn:enhancement-6dfe373b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_versioning\">version<\/span><\/strong> of your <span id=\"urn:enhancement-69e93ba0\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span>. Usually, the last built image is identified as the<em> latest<\/em>. The dot (.) <span id=\"urn:enhancement-a0bc4db9\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/parameter\">parameter<\/span> represents the local directory. If you execute the <span id=\"urn:enhancement-b184a3b2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span> <strong>docker image list<\/strong> you should see the new image on the local repository list. The <span id=\"urn:enhancement-c8a765f9\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span> can be started on the local pc using the <span id=\"urn:enhancement-ac89c652\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/command_computing\">command<\/span>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-E6UOmE\">docker run -p 8080:80 -d --name CONTAINER-NAME IMAGE_NAME<\/pre>\n\n\n\n<p class=\" eplus-w2Ct6v\">However, since we want to start the container on <strong><span id=\"urn:batch-analysis-d7589c8d-fbc6-4f71-855d-ad791c15e332\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_azure\">Microsoft Azure<\/span><\/strong>, we need to store the image on a <strong>container registry <\/strong>such as <a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">DockerHub<\/a> (the default option). As mentioned previously, to install <span id=\"urn:enhancement-d5525534\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span>, a <span id=\"urn:enhancement-2513f192\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> Login is required. This allows users access to free <span id=\"urn:enhancement-b3d047f4\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_repository\">repositories<\/span> on DockerHub.<\/p>\n\n\n\n<p class=\" eplus-taoURj\">To create an image for DockerHub, you need to tag it using your DockerHub <strong><span id=\"urn:enhancement-c6a80c08\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/user_computing\">username<\/span><\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-8Xl86K\">docker build -t <strong>&lt;dockerhubusername&gt;<\/strong>\/myfirstapp:v1 .<\/pre>\n\n\n\n<p class=\" eplus-VmgQ6Z\">Finally, push the image using:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted  eplus-M4ejzt\">docker push &lt;dockerhubusername&gt;\/myfirstapp:v1<\/pre>\n\n\n\n<h2 class=\"eplus-86zO2W wp-block-heading\" id=\"5ujfj\">Start the image on an Azure Web App<\/h2>\n\n\n\n<p class=\" eplus-hOmEwu\">To host the container, go to the <span id=\"urn:batch-analysis-70171828-55fb-4897-8dbb-aed0e052aafe\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_azure\">Microsoft Azure<\/span> Portal and create an Azure <span id=\"urn:enhancement-ce75d715\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/web_application\">Web App<\/span> (instructions can be found in the article mentioned in the first paragraph) and select <strong><span id=\"urn:enhancement-8a9350a\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> Container<\/strong> for the <em>Publish<\/em> parameter:<\/p>\n\n\n\n<div class=\"wp-block-image image regular eplus-tBmlUG\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image07_75df7adeae823f0785c7e9fe8fc6657f_800.png\" alt=\"Using Docker in an Azure Web App\"\/><figcaption>Using Docker in an Azure Web App<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-u1yPXX\">Clicking &#8216;Next <span id=\"urn:enhancement-6b2c3893\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span>&#8216; will show the <span id=\"urn:enhancement-a6cf2807\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/docker_software\">Docker<\/span> image <span id=\"urn:enhancement-d8d7398c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">configuration<\/span>:<\/p>\n\n\n\n<div class=\"wp-block-image image regular eplus-1gXGPV\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image08_87a0406c3ee241a6e3028df9fdbcc3bd_800.png\" alt=\"\"\/><figcaption>Docker image <span id=\"urn:enhancement-d0b43ae3\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">configuration<\/span><\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-bHVbna\">Change the <span id=\"urn:enhancement-15dc1a20\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">configuration<\/span> to these settings:<\/p>\n\n\n\n<ul class=\"eplus-VPP0bG wp-block-list\"><li><strong><span id=\"urn:enhancement-fdc7411c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">Options<\/span><\/strong>: Single Container;<\/li><li><strong>Image Source<\/strong>: Docker Hub;<\/li><li><strong>Access Type<\/strong>: Public;<\/li><li><strong>Image and Tag<\/strong>: the image name and tag previously created.<\/li><\/ul>\n\n\n\n<p class=\" eplus-EuMYRd\">Click to &#8216;Review + Create&#8217; and then click on &#8216;Create&#8217;. <span id=\"urn:batch-analysis-f52a2a1d-b247-4e24-85b9-b6540e97b6fc\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_azure\">Microsoft Azure<\/span> will start the resource provisioning.  Once this is complete, you will be able to navigate to the Azure <span id=\"urn:enhancement-c7aac298\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/web_application\">Web App<\/span> address to check that the <span id=\"urn:enhancement-f1aabdbe\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_software\">application<\/span> will run correctly.<\/p>\n\n\n\n<h2 class=\"eplus-90XAgn wp-block-heading\" id=\"ap0bf\">Start the image on an Azure Container Instance<\/h2>\n\n\n\n<p class=\" eplus-Wy01sZ\">Another way to <span id=\"urn:enhancement-393452b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/software_deployment\">deploy<\/span> a <span id=\"urn:enhancement-27eac1a5\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> in <span id=\"urn:batch-analysis-70c99289-2ea6-4998-a06c-ec49a8d7776c\" class=\"textannotation disambiguated wl-no-link wl-other\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/microsoft_azure\">Microsoft Azure<\/span> is to use an <strong>Azure <span id=\"urn:enhancement-eba7f659\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">Container<\/span> instance<\/strong> (ACI). This service allows you to spin up a <span id=\"urn:enhancement-8f822a8d\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> in a few steps, guaranteeing perfect <strong>isolation<\/strong> for your <span id=\"urn:enhancement-b435bdd1\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/application_software\">application<\/span> and expediting the <span id=\"urn:enhancement-47fe1a05\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/mobile_app\">app<\/span>&#8216;s <strong>scaling<\/strong>. The pricing is also appealing &#8211; you pay only for the time the <span id=\"urn:enhancement-6cb7c15c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">container<\/span> is up.<\/p>\n\n\n\n<p class=\" eplus-MWuylN\">To create an Azure <span id=\"urn:enhancement-185fb24b\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">Container<\/span> instance in the Azure portal, create a new <span id=\"urn:enhancement-33617c6c\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/resource\">resource<\/span> using the side menu. In the search box, type &#8216;<span id=\"urn:enhancement-bc29c8c2\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/containerization\">Container<\/span> Instances&#8217;, and then &#8216;Create&#8217;.<\/p>\n\n\n\n<p class=\" eplus-bdgrnO\">Fill in the ACI <span id=\"urn:enhancement-ec8fdbe9\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">settings<\/span> as in the following image, inserting the name of the image you have created in place of the image name:<\/p>\n\n\n\n<div class=\"wp-block-image image regular eplus-oHjEwc\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/codemotion.com\/magazine\/wp-content\/uploads\/2020\/01\/image09_6f6fe4e530e6522b4a1782004674a4b4_800.png\" alt=\"Creating an Azure Container Instance\"\/><figcaption>Creating an Azure Container Instance<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\" eplus-xxXLhq\">Once this is done, click to &#8216;Review + Create&#8217; and then on &#8216;Create&#8217;. When the provisioning completes, check the <span id=\"urn:enhancement-ec35e01f\" class=\"textannotation disambiguated wl-thing\" itemid=\"http:\/\/data.wordlift.io\/wl01770\/entity\/computer_configuration\">settings<\/span> page of your ACI for the assigned IP address to visit the running app.<\/p>\n\n\n\n<h2 class=\"eplus-PNRbcn wp-block-heading\" id=\"97tpd\">Advanced scenarios<\/h2>\n\n\n\n<p class=\" eplus-V7G1Jh\">Until now, we have considered only a simple scenario with just one image.  Using multiple images that work together requires an orchestrator like <strong>Kubernetes<\/strong> to help you provision, manage, and scale. A forthcoming article will cover this topic, focusing on the <strong>Azure Kubernetes Service<\/strong>.<\/p>\n\n\n\n\n\n<p class=\" eplus-qN1nwU\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to create a Docker image for your ASP.NET core app and deploy it on Microsoft Azure.<\/p>\n","protected":false},"author":9,"featured_media":6947,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":7,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[5244],"tags":[4139],"collections":[],"class_list":{"0":"post-2987","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-cloud","8":"tag-azure","9":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Docker on Microsoft Azure Web App and Container Instance - Codemotion<\/title>\n<meta name=\"description\" content=\"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Running Docker images on Microsoft Azure\" \/>\n<meta property=\"og:description\" content=\"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-30T08:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-05T19:05:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Antonio Turibbio Liccardi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@turibbio\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Antonio Turibbio Liccardi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\"},\"author\":{\"name\":\"Antonio Turibbio Liccardi\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/7e8f9aade09a4e3ba0ba01c0eaa1a0a0\"},\"headline\":\"Running Docker images on Microsoft Azure\",\"datePublished\":\"2020-07-30T08:16:00+00:00\",\"dateModified\":\"2022-01-05T19:05:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\"},\"wordCount\":1503,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png\",\"keywords\":[\"Azure\"],\"articleSection\":[\"Cloud\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\",\"name\":\"Docker on Microsoft Azure Web App and Container Instance - Codemotion\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png\",\"datePublished\":\"2020-07-30T08:16:00+00:00\",\"dateModified\":\"2022-01-05T19:05:29+00:00\",\"description\":\"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DevOps\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/devops\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Cloud\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Running Docker images on Microsoft Azure\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/7e8f9aade09a4e3ba0ba01c0eaa1a0a0\",\"name\":\"Antonio Turibbio Liccardi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/71a132e506f96e21890c26c9f5a2c7c95e1650374779bf23a824e7adf5448868?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/71a132e506f96e21890c26c9f5a2c7c95e1650374779bf23a824e7adf5448868?s=96&d=mm&r=g\",\"caption\":\"Antonio Turibbio Liccardi\"},\"description\":\"I'm a book author and trainer working as Cloud Developer and DevOps Engineer at Blexin. I love sharing, so I co-founded \u201cDotNetCampania\u201d (an Italian .NET community), to help other developers to improve their knowledge about .NET Ecosystem and coding in general. I'm also a frequent speaker at conferences, and I've been awared by Microsoft as MVP for Visual Studio Developer Technologies since 2015.\",\"sameAs\":[\"https:\/\/x.com\/turibbio\"],\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/antonio-turibbio-liccardi\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Docker on Microsoft Azure Web App and Container Instance - Codemotion","description":"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/","og_locale":"en_US","og_type":"article","og_title":"Running Docker images on Microsoft Azure","og_description":"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.","og_url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2020-07-30T08:16:00+00:00","article_modified_time":"2022-01-05T19:05:29+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png","type":"image\/png"}],"author":"Antonio Turibbio Liccardi","twitter_card":"summary_large_image","twitter_creator":"@turibbio","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Antonio Turibbio Liccardi","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/"},"author":{"name":"Antonio Turibbio Liccardi","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/7e8f9aade09a4e3ba0ba01c0eaa1a0a0"},"headline":"Running Docker images on Microsoft Azure","datePublished":"2020-07-30T08:16:00+00:00","dateModified":"2022-01-05T19:05:29+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/"},"wordCount":1503,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png","keywords":["Azure"],"articleSection":["Cloud"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/","url":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/","name":"Docker on Microsoft Azure Web App and Container Instance - Codemotion","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png","datePublished":"2020-07-30T08:16:00+00:00","dateModified":"2022-01-05T19:05:29+00:00","description":"Learn to create a Docker image for your ASP.NET core app and how to deploy it on an Azure Web App and an Azure Container Instance.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/run-docker-image-on-microsoft-azure\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"DevOps","item":"https:\/\/www.codemotion.com\/magazine\/devops\/"},{"@type":"ListItem","position":3,"name":"Cloud","item":"https:\/\/www.codemotion.com\/magazine\/devops\/cloud\/"},{"@type":"ListItem","position":4,"name":"Running Docker images on Microsoft Azure"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/7e8f9aade09a4e3ba0ba01c0eaa1a0a0","name":"Antonio Turibbio Liccardi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/71a132e506f96e21890c26c9f5a2c7c95e1650374779bf23a824e7adf5448868?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/71a132e506f96e21890c26c9f5a2c7c95e1650374779bf23a824e7adf5448868?s=96&d=mm&r=g","caption":"Antonio Turibbio Liccardi"},"description":"I'm a book author and trainer working as Cloud Developer and DevOps Engineer at Blexin. I love sharing, so I co-founded \u201cDotNetCampania\u201d (an Italian .NET community), to help other developers to improve their knowledge about .NET Ecosystem and coding in general. I'm also a frequent speaker at conferences, and I've been awared by Microsoft as MVP for Visual Studio Developer Technologies since 2015.","sameAs":["https:\/\/x.com\/turibbio"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/antonio-turibbio-liccardi\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-600x400.png","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-600x600.png","author_info":{"display_name":"Antonio Turibbio Liccardi","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/antonio-turibbio-liccardi\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png",1200,675,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-150x150.png",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-300x169.png",300,169,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-768x432.png",768,432,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-1024x576.png",1024,576,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png",1200,675,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png",1200,675,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev.png",100,56,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-180x128.png",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-896x504.png",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-400x225.png",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-600x400.png",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2020\/07\/cloud-dev-600x600.png",600,600,true]},"uagb_author_info":{"display_name":"Antonio Turibbio Liccardi","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/antonio-turibbio-liccardi\/"},"uagb_comment_info":0,"uagb_excerpt":"Learn how to create a Docker image for your ASP.NET core app and deploy it on Microsoft Azure.","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2987","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=2987"}],"version-history":[{"count":15,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2987\/revisions"}],"predecessor-version":[{"id":11949,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/2987\/revisions\/11949"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/6947"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=2987"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=2987"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=2987"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=2987"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}