{"id":2788,"date":"2023-05-23T18:32:37","date_gmt":"2023-05-23T17:32:37","guid":{"rendered":"https:\/\/hypervlab.co.uk\/?p=2788"},"modified":"2023-05-23T18:32:39","modified_gmt":"2023-05-23T17:32:39","slug":"building-your-first-docker-container","status":"publish","type":"post","link":"https:\/\/hypervlab.co.uk\/?p=2788","title":{"rendered":"Building your first docker container"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<p>Hellooo again, I know so soon right?! In the last blog post, we learnt the basics of creating a docker image, If you missed that post you can <a href=\"https:\/\/hypervlab.co.uk\/2023\/05\/building-your-first-docker-image\/\" target=\"_blank\" rel=\"noreferrer noopener\">check that out here<\/a>. So as promised in this post we will cover deploying the container locally and &#8220;execing&#8221; into the container and running some code. <\/p>\n\n\n\n<p>So let&#8217;s pick up where we left off last time, We have our alpine image &#8220;myalpineimage&#8221; with three versions.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker image list <\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-1024x569.png\" alt=\"\" class=\"wp-image-2790\" width=\"768\" height=\"427\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-1024x569.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-300x167.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-768x427.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-1536x854.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-756x420.png 756w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-640x356.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24-681x378.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-24.png 1614w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<p>So we have a docker image, which is ready to be deployed, We can use the command docker run. for more information about the docker run commands, you can check out the docker run page [<a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/run\/\" target=\"_blank\" rel=\"noreferrer noopener\">Link here<\/a>]. In the example below we are using the following flags.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run &#91;OPTIONS] IMAGE &#91;COMMAND] &#91;ARG...]<\/code><\/pre>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Flags<\/td><td>Description<\/td><\/tr><tr><td>-i<\/td><td>Keep STDIN open even if not attached<\/td><\/tr><tr><td>-t<\/td><td>Allocate a pseudo-TTY<\/td><\/tr><tr><td>-d<\/td><td>Run container in background and print container ID<\/td><\/tr><tr><td>pwsh or bash<\/td><td>creating an interactive&nbsp;shell session for code execution<\/td><\/tr><\/tbody><\/table><\/figure>\n<\/div><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a container and connecting into it <\/h3>\n\n\n\n<p>So you want to quickly test your container or check something inside of it? If you pass just the -t it will create a container but then close on exit<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> docker run -t myalpineimage:0.2 pwsh<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-1024x569.png\" alt=\"\" class=\"wp-image-2796\" width=\"768\" height=\"427\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-1024x569.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-300x167.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-768x427.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-1536x854.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-756x420.png 756w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-640x356.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25-681x378.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-25.png 1614w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<p>While we are connected to the container, If we check the running docker containers we see that it&#8217;s active and running <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps <\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-1024x569.png\" alt=\"\" class=\"wp-image-2797\" width=\"768\" height=\"427\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-1024x569.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-300x167.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-768x427.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-1536x854.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-756x420.png 756w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-640x356.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26-681x378.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-26.png 1614w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<p>However, as soon as we quit the running instance of &#8220;keen_saha&#8221; we can see that the container instance has been stopped.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-1024x569.png\" alt=\"\" class=\"wp-image-2798\" width=\"768\" height=\"427\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-1024x569.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-300x167.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-768x427.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-1536x854.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-756x420.png 756w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-640x356.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27-681x378.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-27.png 1614w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Creating a container without auto-connecting to shell <\/h3>\n\n\n\n<p>If you wanted to start the container with a headless deployment and not need to exec into the container you can run the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -i -t -d myalpineimage:0.2 pwsh<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-1024x569.png\" alt=\"\" class=\"wp-image-2799\" width=\"768\" height=\"427\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-1024x569.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-300x167.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-768x427.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-1536x854.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-756x420.png 756w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-640x356.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28-681x378.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-28.png 1614w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<p>As we can see the container is running and we&#8217;ve not yet exec&#8217;d into the container. <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-1024x528.png\" alt=\"\" class=\"wp-image-2800\" width=\"768\" height=\"396\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-1024x528.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-300x155.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-768x396.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-1536x792.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-814x420.png 814w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-640x330.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29-681x351.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-29.png 1739w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Connecting to an existing running container<\/h2>\n\n\n\n<p>Finally, If you have a fleet of running containers and you need to connect to a container instance for diagnostics you can run the following commands, Firstly we want to see which containers are running. &#8211; In this example, we have 5 containers instances <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-1024x528.png\" alt=\"\" class=\"wp-image-2803\" width=\"768\" height=\"396\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-1024x528.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-300x155.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-768x396.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-1536x792.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-814x420.png 814w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-640x330.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30-681x351.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-30.png 1739w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>\n\n\n<p>to be able to connect to the container we will want to use the docker exec command &#8211; for more information check out the [<a href=\"https:\/\/docs.docker.com\/engine\/reference\/commandline\/exec\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker Docs<\/a>]<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker exec -i -t hardcore_hugle pwsh<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-1024x607.png\" alt=\"\" class=\"wp-image-2804\" width=\"768\" height=\"455\" srcset=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-1024x607.png 1024w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-300x178.png 300w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-768x455.png 768w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-1536x911.png 1536w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-708x420.png 708w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-640x379.png 640w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31-681x404.png 681w, https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/image-31.png 1739w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><\/figure><\/div>","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>Hellooo again, I know so soon right?! In the last blog post, we learnt the basics of creating a docker image, If you missed that post you can check that out here. So as promised in this post we will cover deploying the container locally and &#8220;execing&#8221; into the container and running some code. So [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2760,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[339,338,336,121],"class_list":{"0":"post-2788","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","6":"hentry","7":"category-docker","8":"tag-clouds","10":"tag-docker","11":"tag-linux"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Building your first docker container - HypervLAB<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hypervlab.co.uk\/?p=2788\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building your first docker container - HypervLAB\" \/>\n<meta property=\"og:description\" content=\"Reading Time:  3 minutesHellooo again, I know so soon right?! In the last blog post, we learnt the basics of creating a docker image, If you missed that post you can check that out here. So as promised in this post we will cover deploying the container locally and &#8220;execing&#8221; into the container and running some code. So [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hypervlab.co.uk\/?p=2788\" \/>\n<meta property=\"og:site_name\" content=\"HypervLAB\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-23T17:32:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-23T17:32:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Simon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/smoon_lee\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Simon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788\",\"url\":\"https:\/\/hypervlab.co.uk\/?p=2788\",\"name\":\"Building your first docker container - HypervLAB\",\"isPartOf\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png\",\"datePublished\":\"2023-05-23T17:32:37+00:00\",\"dateModified\":\"2023-05-23T17:32:39+00:00\",\"author\":{\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359\"},\"breadcrumb\":{\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hypervlab.co.uk\/?p=2788\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage\",\"url\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png\",\"contentUrl\":\"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png\",\"width\":1200,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hypervlab.co.uk\/?p=2788#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hypervlab.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building your first docker container\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hypervlab.co.uk\/#website\",\"url\":\"https:\/\/hypervlab.co.uk\/\",\"name\":\"HypervLAB\",\"description\":\"Blogging about all thing Microsoft\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hypervlab.co.uk\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359\",\"name\":\"Simon Lee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/hypervlab.co.uk\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g\",\"caption\":\"Simon Lee\"},\"description\":\"Hi, I'm Simon an IT Enthusiast, PowerShell Geek, Gamer, and Sound Engineer. I've been working with in the IT Industry for around 6 years and have worked across private and public sector companies. The original idea behind \\\"hypervlab\\\" was that I required an 'RnD' environment which would allow me to be able to replicate any kind of enterprise on-premise environment which I could use for learning and testing without learning in a production environment. So in 2019, I decided to branch out and use the domain for a public facing blog to be able to contribute to the IT Community about all things Microsoft.\",\"sameAs\":[\"https:\/\/hypervlab.co.uk\",\"https:\/\/www.linkedin.com\/in\/simon-john-lee\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/smoon_lee\"],\"url\":\"https:\/\/hypervlab.co.uk\/?author=2\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building your first docker container - HypervLAB","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:\/\/hypervlab.co.uk\/?p=2788","og_locale":"en_GB","og_type":"article","og_title":"Building your first docker container - HypervLAB","og_description":"Reading Time:  3 minutesHellooo again, I know so soon right?! In the last blog post, we learnt the basics of creating a docker image, If you missed that post you can check that out here. So as promised in this post we will cover deploying the container locally and &#8220;execing&#8221; into the container and running some code. So [&hellip;]","og_url":"https:\/\/hypervlab.co.uk\/?p=2788","og_site_name":"HypervLAB","article_published_time":"2023-05-23T17:32:37+00:00","article_modified_time":"2023-05-23T17:32:39+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png","type":"image\/png"}],"author":"Simon Lee","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/smoon_lee","twitter_misc":{"Written by":"Simon Lee","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/hypervlab.co.uk\/?p=2788","url":"https:\/\/hypervlab.co.uk\/?p=2788","name":"Building your first docker container - HypervLAB","isPartOf":{"@id":"https:\/\/hypervlab.co.uk\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage"},"image":{"@id":"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage"},"thumbnailUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png","datePublished":"2023-05-23T17:32:37+00:00","dateModified":"2023-05-23T17:32:39+00:00","author":{"@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359"},"breadcrumb":{"@id":"https:\/\/hypervlab.co.uk\/?p=2788#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hypervlab.co.uk\/?p=2788"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/hypervlab.co.uk\/?p=2788#primaryimage","url":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png","contentUrl":"https:\/\/hypervlab.co.uk\/wp-content\/uploads\/2023\/05\/header_building_your_first_docker_container.png","width":1200,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/hypervlab.co.uk\/?p=2788#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hypervlab.co.uk\/"},{"@type":"ListItem","position":2,"name":"Building your first docker container"}]},{"@type":"WebSite","@id":"https:\/\/hypervlab.co.uk\/#website","url":"https:\/\/hypervlab.co.uk\/","name":"HypervLAB","description":"Blogging about all thing Microsoft","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hypervlab.co.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/7d184970612a9c6a5f1babb8b6b4d359","name":"Simon Lee","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/hypervlab.co.uk\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9473a3cf9c75192508eccfd9d072efab80adf04a45083e561d0e3065f681c34c?s=96&d=mm&r=g","caption":"Simon Lee"},"description":"Hi, I'm Simon an IT Enthusiast, PowerShell Geek, Gamer, and Sound Engineer. I've been working with in the IT Industry for around 6 years and have worked across private and public sector companies. The original idea behind \"hypervlab\" was that I required an 'RnD' environment which would allow me to be able to replicate any kind of enterprise on-premise environment which I could use for learning and testing without learning in a production environment. So in 2019, I decided to branch out and use the domain for a public facing blog to be able to contribute to the IT Community about all things Microsoft.","sameAs":["https:\/\/hypervlab.co.uk","https:\/\/www.linkedin.com\/in\/simon-john-lee\/","https:\/\/x.com\/https:\/\/twitter.com\/smoon_lee"],"url":"https:\/\/hypervlab.co.uk\/?author=2"}]}},"_links":{"self":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2788"}],"version-history":[{"count":5,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2788\/revisions"}],"predecessor-version":[{"id":2805,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/2788\/revisions\/2805"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=\/wp\/v2\/media\/2760"}],"wp:attachment":[{"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hypervlab.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}