{"id":70200,"date":"2017-03-07T16:36:17","date_gmt":"2017-03-07T16:36:17","guid":{"rendered":"https:\/\/www.simple-talk.com\/?p=70200"},"modified":"2026-06-04T11:18:43","modified_gmt":"2026-06-04T11:18:43","slug":"working-windows-containers-docker-running","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/devops\/containers-and-virtualization\/working-windows-containers-docker-running\/","title":{"rendered":"Working with Windows Containers and Docker: Up and Running"},"content":{"rendered":"\n<p><strong>Windows containers bring the container model (lightweight, isolated application environments packaged with their dependencies) to Windows workloads &#8211; parallel to Linux containers which dominate the container ecosystem. <\/strong><\/p>\n\n\n\n<p>There are two Windows container types: <br><br>1. Windows Server Containers (process isolation) &#8211; lighter weight, shared OS kernel with the host, applications see an isolated view of processes\/filesystem\/networking but use the host kernel; <\/p>\n\n\n\n<p>2. Hyper-V containers (full virtual machine isolation) &#8211; each container runs in its own lightweight VM, stronger isolation, higher overhead. Docker manages both through the same CLI (docker run, docker build, docker push, docker pull) and Dockerfile syntax &#8211; the difference is runtime configuration, not developer workflow.<\/p>\n\n\n\n<p><strong>This article walks through the end-to-end workflow: setting up a Windows Server environment with the Containers feature, pulling Windows base images from Docker Hub, running containers, building custom container images with Dockerfile, and pushing back to Docker Hub.<\/strong> <\/p>\n\n\n\n<p><em><strong>Update (June 2026):<\/strong> This article uses Windows Server 2016 with Containers on Azure; modern equivalent is Windows Server 2019 or 2022 (same core workflow, different base image tags). For production Windows container deployments in 2024+, evaluate: Azure Container Instances (ACI), Azure Kubernetes Service (AKS) with Windows node pools, or Windows on self-managed Kubernetes. Concepts in this article remain the foundation; deployment patterns have evolved.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-overview\">Overview<\/h2>\n\n\n\n<p>In the previous article in <a href=\"https:\/\/www.red-gate.com\/simple-talk\/collections\/windows-containers-docker-basics-a-complete-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">this series<\/a>, <a href=\"https:\/\/www.simple-talk.com\/sysadmin\/virtualization\/working-windows-containers-docker-basics\/\"><strong>Working with Windows Containers and Docker: The Basics<\/strong><\/a><strong>, <\/strong>I examined the basics of how container virtualization is being implemented in the Windows Server 2016 operating system. With this basic run-through of Windows Containers out of the way, I can go on to explain how you can work with this new feature in Windows Server 2016.<\/p>\n\n\n\n<p><strong>Full series:<\/strong><\/p>\n\n\n<ul>\n<li><a href=\"https:\/\/www.simple-talk.com\/sysadmin\/virtualization\/working-windows-containers-docker-basics\/\">First Part \u2013 The basics<\/a>: the basic principles of how container virtualization is implemented in Windows Server 2016 operating system.<\/li>\n<li><a href=\"https:\/\/www.simple-talk.com\/sysadmin\/virtualization\/working-windows-containers-docker-running\/\">Second part \u2013 Up and Running<\/a>: creating and managing Windows Server Containers using Docker.<\/li>\n<li><a href=\"https:\/\/www.red-gate.com\/simple-talk\/sysadmin\/virtualization\/working-windows-containers-docker-stride\/\">Third part \u2013 Into your Stride<\/a> Working with Windows Containers and Docker<\/li>\n<li><a href=\"https:\/\/www.red-gate.com\/simple-talk\/sysadmin\/containerization\/working-windows-containers-docker-save-data\/\">Fourth part<\/a> -- Save the Container Data<\/li>\n<\/ul>\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-windows-server-2016-with-containers-on-azure\">Windows Server 2016 with Containers on Azure<\/h2>\n\n\n\n<p>For many Developers and Sysadmins, it makes a lot of sense to deploy services to the Microsoft Azure cloud, but you have the additional option of deploying your Container Host to the Microsoft Azure cloud. One of the advantages of using Azure in this way is that you can deploy a Windows Server 2016 virtual machine with the Containers feature already installed. By doing so, you are then able to experiment with Windows Server Container, with both Server Core and Nano Server Container OS Images installed and ready to use with Docker.<\/p>\n\n\n\n<p>Log in to your Azure portal and create a virtual machine using the Windows Server 2016 Core with Containers image, as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1512\" height=\"678\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-1.png\" alt=\"\" class=\"wp-image-70201\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-docker-commands\">Docker Commands<\/h2>\n\n\n\n<p>How do you set about working with Docker on Windows Server? Before going more into the practical side, we need to get familiar with the essential Docker PowerShell commands. You can run the <strong><em>docker \u2013help<\/em><\/strong> command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Commands:\n    attach      Attach to a running container\n    build       Build an image from a Dockerfile\n    commit      Create a new image from a container's changes\n    cp          Copy files\/folders between a container and the local filesystem\n    create      Create a new container\n    diff        Inspect changes on a container's filesystem\n    events      Get real time events from the server\n    exec        Run a command in a running container\n    export      Export a container's filesystem as a tar archive\n    history     Show the history of an image\n    images      List images\n    import      Import the contents from a tarball to create a filesystem image\n    info        Display system-wide information\n    inspect     Return low-level information on a container, image or task\n    kill        Kill one or more running containers\n    load        Load an image from a tar archive or STDIN\n    login       Log in to a Docker registry.\n    logout      Log out from a Docker registry.\n    logs        Fetch the logs of a container\n    pause       Pause all processes within one or more containers\n    port        List port mappings or a specific mapping for the container\n    ps          List containers\n    pull        Pull an image or a repository from a registry\n    push        Push an image or a repository to a registry\n    rename      Rename a container\n    restart     Restart one or more containers\n    rm          Remove one or more containers\n    rmi         Remove one or more images\n    run         Run a command in a new container\n    save        Save one or more images to a tar archive (streamed to STDOUT by default)\n    search      Search the Docker Hub for images\n    start       Start one or more stopped containers\n    stats       Display a live stream of container(s) resource usage statistics\n    stop        Stop one or more running containers\n    tag         Tag an image into a repository\n    top         Display the running processes of a container\n    unpause     Unpause all processes within one or more containers\n    update      Update configuration of one or more containers\n    version     Show the Docker version information\n    wait        Block until one or more containers stop, then print their exit codes\n  Run 'docker COMMAND --help' for more information on a command.<\/pre>\n\n\n\n<p>There is enough here for everyday use. We\u2019ll get started by using one of the most common of the Docker commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker images<\/pre>\n\n\n\n<p>This command shows you which Docker Images are available locally. After installing Windows Containers no Docker Images are, as yet, installed. The first thing you have to do is to pull Windows Server Images from the Docker Hub. You don\u2019t need a Docker Hub Account to perform this task:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker pull &lt;image_name&gt;<\/pre>\n\n\n\n<p>I will describe this command in more detail in the next section. When you have at least one image available, you can start a Windows Container:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker run -\u2013name &lt;Container_Name&gt; &lt;Image_Name&gt;<\/pre>\n\n\n\n<p>It means that a Windows Container called <strong>&lt;Container_Name&gt;<\/strong> will be started from the Image called <strong>&lt;Image_Name&gt;.<\/strong> When you have more than one container running, it can be useful to get a list of all running containers:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker ps<\/pre>\n\n\n\n<p>Finally, you will need some information about your containers, such as the IP Address. Use the following to retrieve this information:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker inspect<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-retrieve-images-from-docker-hub\">Retrieve Images from Docker Hub<\/h2>\n\n\n\n<p>In Docker container parlance, the image is the template from which you spawn new containers. We can download some pre-built Docker images from the Docker Hub. At the time this was written, Microsoft has two container images in their gallery: Nano Server and Windows Server Core. Let&#8217;s download them both by pulling the images from Docker Hub:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker images\n  REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE\n  PS &gt; docker pull microsoft\/windowsservercore\n  Using default tag: latest\n  latest: Pulling from microsoft\/windowsservercore\n  3889bb8d808b: Downloading [=&gt;                                                 ] 102.7 MB\/4.07 GB\n  3430754e4d17: Downloading [=====&gt;                                             ] 102.2 MB\/913.1 MB\n  PS &gt; docker pull microsoft\/nanoserver\n  [\u2026]<\/pre>\n\n\n\n<p>Ok, but how to know the exact name of the image that you need? That\u2019s pretty simple. On Docker Hub, you will notice the following section named \u201cDocker Pull Command\u201d as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1037\" height=\"702\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-2.png\" alt=\"\" class=\"wp-image-70202\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>The only necessary step is to copy and paste the command to download the image. Once the image installation process completes (it can take a while, depending on your Internet connection speed), confirm that Windows Server Core image is available locally. Run <strong>Docker images<\/strong> to check:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker images\n  REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE\n  microsoft\/windowsservercore   latest              4d83c32ad497        6 weeks ago         9.56GB\n  microsoft\/nanoserver          latest              d9bccb9d4cac        6 weeks ago         925MB<\/pre>\n\n\n\n<p>If you have deployed the pre-configured virtual machine in Azure, the two base images are already pulled.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-deploy-a-new-windows-container\">Deploy a new Windows Container<\/h2>\n\n\n\n<p>Now we will use the&nbsp;<a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/run\/\"><strong>Docker<\/strong><\/a><strong> run<\/strong> command&nbsp;to deploy a new container named&nbsp;<strong>CoreServerCMD<\/strong>&nbsp;that uses the Windows Server Core image. The <strong>-it<\/strong> switch denotes an interactive session, and&nbsp;<strong>cmd.exe<\/strong>&nbsp;means that we want to enter the container inside a new cmd.exe console. Be careful, the repository name must be lowercase.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker run -it --name CoreServerCMD microsoft\/windowsservercore cmd.exe\n  Microsoft Windows [Version 10.0.14393]\n  (c) 2016 Microsoft Corporation. All rights reserved.\n  C:\\&gt;ipconfig\n  Windows IP Configuration\n  Ethernet adapter vEthernet (Container NIC b4dc9191):\n     Connection-specific DNS Suffix  . :\n     Link-local IPv6 Address . . . . . : fe80::81ac:61de:7cef:3467%17\n     IPv4 Address. . . . . . . . . . . : 172.21.149.87\n     Subnet Mask . . . . . . . . . . . : 255.255.240.0\n     Default Gateway . . . . . . . . . : 172.21.144.1<\/pre>\n\n\n\n<p>Basically, the&nbsp;<strong>docker run<\/strong>&nbsp;translates the&nbsp;<strong>cmd.exe<\/strong>&nbsp;command within the new Server Core-based container. Now, we have a container named <strong>CoreServerCMD<\/strong> which is running. We can check with the <strong>Docker ps<\/strong> command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker ps\n  CONTAINER ID  IMAGE                        COMMAND  CREATED       STATUS       NAMES\n  9e8e23686548  microsoft\/windowsservercore \"cmd.exe\" 5 minutes ago Up 3 minutes CoreServerCMD<\/pre>\n\n\n\n<p>The <strong>Docker ps<\/strong> command by default shows only running containers but passing the <strong>-a<\/strong> flag to the command will show all containers. You can start and stop containers very simply by running:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; <a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/stop\/\">docker stop<\/a> CoreServerCMD\n  CoreServerCMD\n  PS &gt; <a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/stop\/\">docker st<\/a>art CoreServerCMD\n  CoreServerCMD<\/pre>\n\n\n\n<p>When you start a Windows Container, take a look at the Task Manager tool and you will notice a new process called \u201cDocker\u201d. When you stop your container, this process will disappear:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"371\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-3.png\" alt=\"\" class=\"wp-image-70203\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>OK, the container is up and running but you don\u2019t need to execute the <strong>docker run<\/strong> command once again. To re-enter the running container, the <strong>docker attach<\/strong> command will do the job:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; <a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/attach\/\">docker attach<\/a>&nbsp;CoreServerCMD<\/pre>\n\n\n\n<p>Containers have both a name and identifier, and either of them can be used to identify the container to inspect. <strong>Inspect<\/strong> is a core Docker instruction (<a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/inspect\/\">Docker Docs- Docker Inspect<\/a>) that allows you to get all the information about Container and Image. Below, I inspect my container:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker inspect CoreServerCMD\n  [\n      {\n          \"Id\": \"9e8e236865487f3f715d2b1d5582512d9f068f97219c01249a497e03afcff94d\",\n          \"Created\": \"2017-02-26T12:20:41.2866341Z\",\n          \"Path\": \"cmd.exe\",\n          \"Args\": [],\n          \"State\": {\n              \"Status\": \"exited\",\n              \"Running\": false,\n              \"Paused\": false,\n              \"Restarting\": false,\n              \"OOMKilled\": false,\n              \"Dead\": false,\n              \"Pid\": 0,\n              \"ExitCode\": 9009,\n              \"Error\": \"\",\n              \"StartedAt\": \"2017-02-26T12:24:24.8655415Z\",\n              \"FinishedAt\": \"2017-02-26T12:32:26.5074121Z\"\n          },\n          \"Image\": \"sha256:4d83c32ad497f063ae77377afb9285ed3f8a2d2dc52eb53268a7152777b25add\",\n          \"ResolvConfPath\": \"\",\n          \"HostnamePath\": \"\",\n          \"HostsPath\": \"\",\n          \"LogPath\": \"C:\\\\ProgramData\\\\docker\\\\containers\\\\9e8e236865487f3f715d2b1d5582512d9f068f97219c01249a497e03afcff94d\\\\9e8e236865487f3f715d2b1d5582512d9f068f97219c01249a497e03afcff94d-json.log\",\n          \"Name\": \"\/CoreServerCMD\",\n          \"RestartCount\": 0,\n          \"Driver\": \"windowsfilter\",\n          \"MountLabel\": \"\",\n          \"ProcessLabel\": \"\",\n          \"AppArmorProfile\": \"\",\n          \"ExecIDs\": null,\n          \"HostConfig\": {\n              \"Binds\": null,\n              \"ContainerIDFile\": \"\",\n              \"LogConfig\": {\n                  \"Type\": \"json-file\",\n                  \"Config\": {}\n              },\n              \"NetworkMode\": \"default\",\n              \"PortBindings\": {},\n              \"RestartPolicy\": {\n                  \"Name\": \"no\",\n                  \"MaximumRetryCount\": 0\n  [\u2026]<\/pre>\n\n\n\n<p>The output has been truncated. You can display specific settings using the <strong>\u2013f<\/strong> parameter:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker inspect -f '{{.Config.Hostname}}'  CoreServerCMD\n  9e8e23686548\n  PS &gt; docker inspect -f '{{.Config.Image}}'  CoreServerCMD\n  microsoft\/windowsservercore\n  PS &gt; docker inspect -f '{{.NetworkSettings.IPAddress}}'  CoreServerCMD\n  172.21.149.87<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-build-your-own-container-image\">Build your own container image<\/h2>\n\n\n\n<p>Docker containers are created by using base images. Basically, an image can contain nothing more than the operating-system fundamentals, or it can contain a full application stack ready for use. So, let\u2019s see an example. You may have a custom website that you want to deploy in a Windows Container. You have two ways to do the job. You can run a Windows Container or just use a Docker file. To run a Windows Container, install and configure the IIS role and finally import your html files: To use a Docker File takes a bit more explaining. Just imagine, for the sake of this example, that you have a folder called \u201cMyWebSite\u201d containing two files:<\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Index.html<\/li>\n\n\n\n<li>Dockerfile<\/li>\n<\/ul>\n<\/div>\n\n\n<p><strong>What is a Dockerfile?<\/strong><\/p>\n\n\n\n<p>Dockerfile is a script, composed of various \u201ccommands\u201d also called \u201cinstructions\u201d and arguments listed successively to automatically perform actions on a base image in order to create a new one. The Dockerfile greatly helps with deployments by automating and simplifying this process.<\/p>\n\n\n\n<p>Below is the content of my Dockerfile:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">FROM microsoft\/iis\n\tMAINTAINER Nicolas PRIGENT\n\tRUN mkdir C:\\site\n\tRUN powershell -NoProfile -Command \\\n\t    Import-module IISAdministration; \\\n\t    New-IISSite -Name \"Site\" -PhysicalPath C:\\site -BindingInformation \"*:8080:\"\n\tCOPY index.html C:\\site\n\tEXPOSE 8080\n<\/pre>\n\n\n\n<p>My Dockerfile begins with a \u201cFROM\u201d keyword. This keyword defines an image from which the build process starts. In my example, I will use the Microsoft IIS image, then create a folder and finally run some PowerShell commands via the \u201cRUN\u201d keyword. Thanks to this Dockerfile, Docker will create a new container image. A&nbsp;container image&nbsp;is the captured state information of a container that you have created and customized on a container host. Once you have customized a container image for a particular purpose, you can then use it to create new containers from it. It\u2019s something like a \u201cTemplate\u201d for creating new containers for some specific purpose that you can list with the <strong>Docker images <\/strong>command.<\/p>\n\n\n\n<p><strong>Creating a container image<\/strong><\/p>\n\n\n\n<p>OK, my Dockerfile is ready. Here are the commands I need to run to create my new image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; cd C:\\MyWebsite\n  PS C:\\MyWebsite&gt; docker build -t myiis .\n  Sending build context to Docker daemon  3.072kB\n  Step 1\/6 : FROM microsoft\/iis\n   ---&gt; a3dd2dff392b\n  Step 2\/6 : MAINTAINER Nicolas PRIGENT\n   ---&gt; Running in 2325e0d1cad2\n   ---&gt; 5c647612617c\n  Removing intermediate container 2325e0d1cad2\n  Step 3\/6 : RUN mkdir C:\\site\n   ---&gt; Running in bec661fdb10c\n   ---&gt; 5173bcee6d03\n  Removing intermediate container bec661fdb10c\n  Step 4\/6 : RUN powershell -NoProfile -Command     Import-module IISAdministration;     New-IISSite -Name \"Site\" -PhysicalPath C:\\site -BindingInformation \"*:8080:\"\n   ---&gt; Running in d9abe719e201\n   ---&gt; 0d84ea9a9af5\n  Removing intermediate container d9abe719e201\n  Step 5\/6 : COPY index.html C:\\site\n   ---&gt; b6b3342f2761\n  Removing intermediate container 45e11d3a432f\n  Step 6\/6 : EXPOSE 8080\n   ---&gt; Running in 7f8983d773d5\n   ---&gt; f815a0ab0695\n  Removing intermediate container 7f8983d773d5\n  Successfully built f815a0ab0695<\/pre>\n\n\n\n<p>\u201cmyiis\u201d is the repository name and must be lowercase. At the end of my Dockerfile, I expose my website on the 8080 port number. At this step, I can confirm that my container image has been successfully created:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker images\n  REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE\n  myiis                         latest              5b4148e14c8f        45 seconds ago      9.82GB\n  microsoft\/iis                 latest              a3dd2dff392b        6 weeks ago         9.82GB\n  microsoft\/windowsservercore   latest              4d83c32ad497        7 weeks ago         9.56GB\n  microsoft\/nanoserver          latest              d9bccb9d4cac        7 weeks ago         925MB<\/pre>\n\n\n\n<p>Now, I just have to use <strong>Docker run<\/strong> to create a new container from my new container image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker run -d -p 8080:8080 --name websitecontainer myiis\n  PS &gt; docker ps\n  CONTAINER ID        IMAGE      [\u2026]    STATUS                  PORTS                    NAMES\n  a6a41cf3b19c        myiis      [\u2026]    Up Less than a second   0.0.0.0:8080-&gt;8080\/tcp   websitecontainer <\/pre>\n\n\n\n<p>That\u2019s cool, my container is up and running. I can get the container IP Address with the following command and go to my website on the following URL: http:\/\/172.21.158.179:8080<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' a6a41cf3b19c\n  172.21.158.179\n  Or\n  PS &gt; docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' websitecontainer\n  172.21.158.179<\/pre>\n\n\n\n<p>Please be careful; because if you begin with Docker and Windows Containers, you will probably make the following mistake: You will try to get the IP address from the image instead of the container. Ensure you get the container ID from <strong>docker ps<\/strong>. if you use the image name, you are asking Docker to show you the IP Address of the image. This, of course, does not make sense, because images do not have IP Addresses.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-push-your-images-to-docker-hub\">Push your images to Docker Hub<\/h2>\n\n\n\n<p>First, you must create a free Docker account here: <a href=\"https:\/\/cloud.docker.com\/\">https:\/\/cloud.docker.com\/<\/a>. Docker Hub lets you store and share your base images. It means that co-workers can use your base image from your repository.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"381\" height=\"383\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-4.png\" alt=\"\" class=\"wp-image-70204\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>You can create repositories and manually&nbsp;<a href=\"https:\/\/docs.docker.com\/datacenter\/dtr\/2.2\/guides\/user\/manage-images\/pull-and-push-images\/\">push images<\/a>&nbsp;using&nbsp;the <strong>docker push<\/strong> command. These repositories can be either public or private. You can create one private repository for free, and unlimited public repositories.<\/p>\n\n\n\n<p>Click on <strong>Repositories<\/strong> and <strong>Create<\/strong>. You must enter a name and an optional description. Next, choose a visibility setting for the repository.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"888\" height=\"818\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-5.png\" alt=\"\" class=\"wp-image-70205\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>When you need to push an image to Docker Hub, you must use three commands. The first one will tag the image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker tag f45ecff4c38c getcmd\/lab:latest<\/pre>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li><strong>Getcmd<\/strong> is my Docker ID<\/li>\n\n\n\n<li><strong>Lab<\/strong> is my private repository<\/li>\n\n\n\n<li><strong>Latest<\/strong> is the tag<\/li>\n<\/ul>\n<\/div>\n\n\n<p>Now run the <strong>docker images<\/strong> command to verify that the same image ID now exists in two different repositories.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker images\n  REPOSITORY         TAG            IMAGE ID            CREATED             SIZE\n  getcmd\/lab         latest         f45ecff4c38c        2 hours ago         9.89GB\n  myiis              latest         f45ecff4c38c        2 hours ago         9.89GB<\/pre>\n\n\n\n<p>The second command stores your credentials using the <strong>docker login<\/strong> command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker login\n  Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https:\/\/hub.docker.com to create one.\n  Username: getcmd\n  Password:\n  Login Succeeded<\/pre>\n\n\n\n<p>Now, you can push the image:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">PS &gt; docker push getcmd\/lab\n  The push refers to a repository [docker.io\/getcmd\/lab]\n  0a2abd09b43e: Pushed\n  68da241f1f36: Pushed\n  26de02533429: Pushed\n  12af8be2d3dc: Pushed\n  b54f48930406: Pushed\n  5b4aace84103: Mounted from microsoft\/iis\n  1f2f3eb32edc: Pushed\n  0451551dda21: Pushed\n  c28d44287ce5: Skipped foreign layer\n  f358be10862c: Skipped foreign layer\n  latest: digest: sha256:95fa14a4e1af0d8b52ed6dc10c06b6f1085285126ddef2882210dd904de88565 size: 2619\n  latest: digest: size: 2619<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"311\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/03\/word-image-6.png\" alt=\"\" class=\"wp-image-70206\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Note: You can log out of Docker Hub using <strong>docker logout<\/strong> command<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>In this article we discussed about the Docker commands that allow you to work with Windows containers. We also download Container images from the Docker HUB, and we have created a free Docker account to store our own images. Next, we have seen how to build our container image and create a container from the container image.<\/p>\n\n\n\n<p>Containerization provides you with an open-ended device that can simplify your deployments in many different ways. In the next article, I will explain how to use Hyper-V Containers, how to convert Windows services to run in a Windows Container, and reveal the mysteries of <strong>Docker-compose<\/strong>.<\/p>\n\n\n\n<p>I hope that this article has helped you to understand more about Windows Containers.<\/p>\n\n\n\n<section id=\"my-first-block-block_317e1e2a139528cbfd6f5b7c8413d3e7\" class=\"my-first-block alignwide\">\n    <div class=\"bg-brand-600 text-base-white py-5xl px-4xl rounded-sm bg-gradient-to-r from-brand-600 to-brand-500 red\">\n        <div class=\"gap-4xl items-start md:items-center flex flex-col md:flex-row justify-between\">\n            <div class=\"flex-1 col-span-10 lg:col-span-7\">\n                <h3 class=\"mt-0 font-display mb-2 text-display-sm\">Simple Talk is brought to you by Redgate Software<\/h3>\n                <div class=\"child:last-of-type:mb-0\">\n                                            Take control of your databases with the trusted Database DevOps solutions provider. Automate with confidence, scale securely, and unlock growth through AI.                                    <\/div>\n            <\/div>\n                                            <a href=\"https:\/\/www.red-gate.com\/solutions\/overview\/\" class=\"btn btn--secondary btn--lg\" aria-label=\"Discover how Redgate can help you: Simple Talk is brought to you by Redgate Software\">Discover how Redgate can help you<\/a>\n                    <\/div>\n    <\/div>\n<\/section>","protected":false},"excerpt":{"rendered":"<p>Getting started with Windows containers and Docker &#8211; setting up Windows Server with Containers on Azure, essential Docker commands (pull, run, build, push), retrieving images from Docker Hub, deploying Windows containers, building custom images with Dockerfile, and pushing images back to Docker Hub.&hellip;<\/p>\n","protected":false},"author":158223,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143513,143512],"tags":[42487,48325,159403],"coauthors":[6804],"class_list":["post-70200","post","type-post","status-publish","format-standard","hentry","category-containers-and-virtualization","category-devops","tag-dev","tag-windows_containers","tag-windowscontainersdockerseries"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/70200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/158223"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=70200"}],"version-history":[{"count":9,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/70200\/revisions"}],"predecessor-version":[{"id":111225,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/70200\/revisions\/111225"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=70200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=70200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=70200"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=70200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}