{"id":42,"date":"2023-05-11T21:20:18","date_gmt":"2023-05-11T21:20:18","guid":{"rendered":"https:\/\/feellikelearning.com\/en\/?p=42"},"modified":"2023-05-11T21:20:19","modified_gmt":"2023-05-11T21:20:19","slug":"in-docker-compose-yml-what-does-this-meanports-backend_port-8080","status":"publish","type":"post","link":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/","title":{"rendered":"in docker-compose.yml, what does this mean?ports: &#8211; &#8220;${BACKEND_PORT:-80}:80&#8221;"},"content":{"rendered":"\n<p>In a Docker Compose file (<code>docker-compose.yml<\/code>), the <code>ports<\/code> section is used to expose network ports for services defined in the file. It allows containers to listen on specified ports and make them accessible from outside the Docker environment.<\/p>\n\n\n\n<p>In the given example, the <code>ports<\/code> section is using the following format:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ports:\n  - \"${BACKEND_PORT:-80}:80\"\n<\/code><\/pre>\n\n\n\n<p>This line maps the host machine&#8217;s port to the container&#8217;s port. Let&#8217;s break it down:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>${BACKEND_PORT:-80}<\/code>: This is a variable substitution that allows flexibility in specifying the host machine&#8217;s port. It uses the value of the environment variable <code>BACKEND_PORT<\/code> if it is defined, or falls back to the default value of <code>80<\/code> if the variable is not set. It means that you can override the default port by setting the <code>BACKEND_PORT<\/code> environment variable.<\/li>\n\n\n\n<li><code>80:80<\/code>: This represents the port mapping in the format <code>&lt;host_port&gt;:&lt;container_port&gt;<\/code>. In this case, it maps port <code>80<\/code> of the container to the same port <code>80<\/code> of the host machine. So, any traffic that arrives at the host&#8217;s port <code>80<\/code> will be forwarded to the container&#8217;s port <code>80<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>Overall, this configuration allows you to access the backend service running inside the container via the host machine&#8217;s port <code>80<\/code> (or the custom port specified by the <code>BACKEND_PORT<\/code> environment variable). For example, if the host machine&#8217;s IP address is <code>192.168.0.1<\/code>, you can access the backend service by visiting <code>http:\/\/192.168.0.1<\/code> on your web browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a Docker Compose file (docker-compose.yml), the ports section is used to expose network ports for services defined in the file. It allows containers to listen on specified ports and make them accessible from outside the Docker environment. In the given example, the ports section is using the following format: This line maps the host [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>in docker-compose.yml, what does this mean?ports: - &quot;${BACKEND_PORT:-80}:80&quot; - Feel Like Learning<\/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:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"in docker-compose.yml, what does this mean?ports: - &quot;${BACKEND_PORT:-80}:80&quot; - Feel Like Learning\" \/>\n<meta property=\"og:description\" content=\"In a Docker Compose file (docker-compose.yml), the ports section is used to expose network ports for services defined in the file. It allows containers to listen on specified ports and make them accessible from outside the Docker environment. In the given example, the ports section is using the following format: This line maps the host [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/\" \/>\n<meta property=\"og:site_name\" content=\"Feel Like Learning\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-11T21:20:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-11T21:20:19+00:00\" \/>\n<meta name=\"author\" content=\"feellikelearning\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"feellikelearning\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/\",\"url\":\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/\",\"name\":\"in docker-compose.yml, what does this mean?ports: - \\\"${BACKEND_PORT:-80}:80\\\" - Feel Like Learning\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/en\/#website\"},\"datePublished\":\"2023-05-11T21:20:18+00:00\",\"dateModified\":\"2023-05-11T21:20:19+00:00\",\"author\":{\"@id\":\"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/1ec5aac313d6de20215fe2b8e176b8a7\"},\"breadcrumb\":{\"@id\":\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/feellikelearning.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"in docker-compose.yml, what does this mean?ports: &#8211; &#8220;${BACKEND_PORT:-80}:80&#8221;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/feellikelearning.com\/en\/#website\",\"url\":\"https:\/\/feellikelearning.com\/en\/\",\"name\":\"Feel Like Learning\",\"description\":\"keep curiosity alive\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/feellikelearning.com\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/1ec5aac313d6de20215fe2b8e176b8a7\",\"name\":\"feellikelearning\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/36aec9d519f02362e3e89b0716ae640d08701f57e818830f3f197db5fbc1ae20?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/36aec9d519f02362e3e89b0716ae640d08701f57e818830f3f197db5fbc1ae20?s=96&d=mm&r=g\",\"caption\":\"feellikelearning\"},\"sameAs\":[\"http:\/\/feellikelearning.com\/en\"],\"url\":\"https:\/\/feellikelearning.com\/en\/index.php\/author\/feellikelearning\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"in docker-compose.yml, what does this mean?ports: - \"${BACKEND_PORT:-80}:80\" - Feel Like Learning","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:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/","og_locale":"en_US","og_type":"article","og_title":"in docker-compose.yml, what does this mean?ports: - \"${BACKEND_PORT:-80}:80\" - Feel Like Learning","og_description":"In a Docker Compose file (docker-compose.yml), the ports section is used to expose network ports for services defined in the file. It allows containers to listen on specified ports and make them accessible from outside the Docker environment. In the given example, the ports section is using the following format: This line maps the host [&hellip;]","og_url":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/","og_site_name":"Feel Like Learning","article_published_time":"2023-05-11T21:20:18+00:00","article_modified_time":"2023-05-11T21:20:19+00:00","author":"feellikelearning","twitter_card":"summary_large_image","twitter_misc":{"Written by":"feellikelearning","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/","url":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/","name":"in docker-compose.yml, what does this mean?ports: - \"${BACKEND_PORT:-80}:80\" - Feel Like Learning","isPartOf":{"@id":"https:\/\/feellikelearning.com\/en\/#website"},"datePublished":"2023-05-11T21:20:18+00:00","dateModified":"2023-05-11T21:20:19+00:00","author":{"@id":"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/1ec5aac313d6de20215fe2b8e176b8a7"},"breadcrumb":{"@id":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/feellikelearning.com\/en\/index.php\/2023\/05\/11\/in-docker-compose-yml-what-does-this-meanports-backend_port-8080\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/feellikelearning.com\/en\/"},{"@type":"ListItem","position":2,"name":"in docker-compose.yml, what does this mean?ports: &#8211; &#8220;${BACKEND_PORT:-80}:80&#8221;"}]},{"@type":"WebSite","@id":"https:\/\/feellikelearning.com\/en\/#website","url":"https:\/\/feellikelearning.com\/en\/","name":"Feel Like Learning","description":"keep curiosity alive","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/feellikelearning.com\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/1ec5aac313d6de20215fe2b8e176b8a7","name":"feellikelearning","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/feellikelearning.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/36aec9d519f02362e3e89b0716ae640d08701f57e818830f3f197db5fbc1ae20?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/36aec9d519f02362e3e89b0716ae640d08701f57e818830f3f197db5fbc1ae20?s=96&d=mm&r=g","caption":"feellikelearning"},"sameAs":["http:\/\/feellikelearning.com\/en"],"url":"https:\/\/feellikelearning.com\/en\/index.php\/author\/feellikelearning\/"}]}},"_links":{"self":[{"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":1,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":43,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions\/43"}],"wp:attachment":[{"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feellikelearning.com\/en\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}