{"id":5112,"date":"2024-11-08T09:55:46","date_gmt":"2024-11-08T09:55:46","guid":{"rendered":"https:\/\/www.liainfraservices.com\/blog\/?p=5112"},"modified":"2025-02-25T07:28:07","modified_gmt":"2025-02-25T07:28:07","slug":"how-to-set-up-a-local-development-environment-using-docker-compose","status":"publish","type":"post","link":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/","title":{"rendered":"How to set up a Local development environment using docker compose"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span><div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 4,118<\/span><\/div>\n<h2 class=\"wp-block-heading\">What is Docker Compose and How Does it Improve Local Development?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Docker Compose simplifies multi-container application management by using a single YAML file to define and orchestrate <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>services<\/strong> (individual containers), <\/li>\n\n\n\n<li><strong>networks<\/strong> (docker networks with defined driver like bridge, host), and <\/li>\n\n\n\n<li><strong>storage<\/strong> (docker volume or bind mounts) for Docker containers. <\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">The benifit of docker compose: According to me, no one can explain it better than its own documentation, to know more about its benefit, we can read it from <a href=\"https:\/\/docs.docker.com\/compose\/intro\/features-uses\/\">https:\/\/docs.docker.com\/compose\/intro\/features-uses\/<\/a><\/p>\n<\/blockquote>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This writeup will attempt to get you started with Docker Compose, covering <strong>foundational concepts<\/strong>, key <strong>blocks<\/strong>, and <strong>essential commands<\/strong> for a seamless local development experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below is an example of how to create a mind map for managing an application with this Compose setup.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This approach helps organize the dependencies between services, understand traffic flow, and determine the essential port mappings.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the example below, I\u2019ve outlined a 3-tier MERN application to illustrate local development planning:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>React<\/strong> will receive traffic on port 3001 and will need to connect to Express. Since React relies on the Express base URL, we should pass the Express base URL to React, which can be managed via the environment block for the React service.<\/li>\n\n\n\n<li>Similarly, <strong>Express<\/strong> needs to connect to Mongo, so Mongo-related information should be passed to Express through the environment configuration.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I hope this provides a clear and structured approach to setting up your environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Lets dive in. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"917\" src=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-1024x917.png\" alt=\"\" class=\"wp-image-5113\" srcset=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-1024x917.png 1024w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-300x269.png 300w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-768x688.png 768w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-1536x1375.png 1536w, https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-2048x1834.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. <strong>Getting Started with YAML in Docker Compose<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Docker Compose uses a YAML file (<code>compose.yaml<\/code>) to define the application\u2019s services. YAML is human-readable, structured with maps (key-value pairs) and lists (sequences of items), which makes it intuitive for configuring services.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A simple docker compose yaml file looks something like this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.8'  # For newer compose, adding the version is not mandatory\n\nservices:  # Main block where each service (container) is defined\n  app:\n    image: node:18\n    ports:\n      - \"3000:3000\"\n    environment:\n      - NODE_ENV=development\n\n  database:\n    image: mongo:latest\n    ports:\n      - \"27017:27017\"\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. <strong>Understanding Key Blocks in Docker Compose<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Services Block<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>services<\/code> block is where we define each component of our application as a service (container). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Each service has <strong>sub-blocks<\/strong> that specify configuration options, including <code><strong>build<\/strong><\/code>, <code><strong>environment<\/strong><\/code>, <code><strong>volumes<\/strong><\/code>, <code><strong>networks<\/strong><\/code>, and <code><strong>ports<\/strong><\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    image: daspratha\/mern  # This can be used to tag the image and that would be used to push that later on the registry\n    build:  # Optional, it is needed only to build from a Dockerfile\n      context: .  # Build context, usually set to current directory\n      dockerfile: Dockerfile\n    ports:\n      - \"3000:3000\"  # Maps host port 3000 to container port 3000\n    environment:\n      - DATABASE_URL=mongodb:\/\/database:27017\/mydb\n    depends_on:\n      - database  # its the name of the db service(for this we kept it as database), check the next line, it Ensures 'database' service starts before 'app'\n\n  database:\n    image: mongo:latest\n    ports:\n      - \"27017:27017\"\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the above example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>build<\/code> specifies the Dockerfile and context if building locally.<\/li>\n\n\n\n<li><code>ports<\/code> defines port mappings from the container to the host.<\/li>\n\n\n\n<li><code>environment<\/code> provides environment variables to the container.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Networks Block<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>networks<\/code> block creates a custom networks to control communication between containers. Docker Compose automatically creates an isolated network for services, but we can create named networks for greater control.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, we are creating network by the name &#8220;internal-network&#8221; and its using &#8220;dridge&#8221; driver, that means port mapping is needed to reach the application inside container from host machine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>networks:\n  internal-network:\n    driver: bridge\n\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once the network is created (make sure, it should be aligned on the same vertical line as services) we can assign each service(container) with the network, for smooth communicate among them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    networks:\n      - internal-network\n  database:\n    networks:\n      - internal-network\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Volumes Block<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>volumes<\/code> block is used to persist data. Named volumes are managed by Docker, while bind mounts map a directory on the host to a directory in the container.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example of named volume:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>volumes:\n  app-data:  # Named volume to store data persistently\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Usage within a service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    volumes:\n      - app-data:\/usr\/src\/app\/data  # Maps the volume to a path in the container\n  database:\n    volumes:\n      - mongo-data:\/data\/db  # MongoDB data persistence\nvolumes:\n  mongo-data:\n\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Environment Block<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>environment<\/code> block defines environment variables that are passed to the container when it starts. These are often used for configuration, such as database URLs or API keys.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    environment:\n      - NODE_ENV=development\n      - DATABASE_URL=mongodb:\/\/database:27017\/mydb\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">3. <strong>Advanced Options<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Docker Compose Commands<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>docker-compose up<\/code><\/strong>: Builds, (re)creates, and starts the services. Use <code>-d<\/code> to run in detached mode.<\/li>\n\n\n\n<li><strong><code>docker-compose down<\/code><\/strong>: Stops and removes containers, networks, volumes, and images created by <code>up<\/code>.<\/li>\n\n\n\n<li><strong><code>docker-compose build<\/code><\/strong>: Builds or rebuilds services.<\/li>\n\n\n\n<li><strong><code>docker-compose push<\/code><\/strong>: Pushes service images to a registry (useful for deployment).<\/li>\n\n\n\n<li><strong><code>docker-compose logs<\/code><\/strong>: Displays log output from services.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Environment Files<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To avoid hardcoding sensitive information, like we did above, we can store environment variables in a <code><strong>.env<\/strong><\/code> file and reference them in <code><strong>docker-compose.yaml<\/strong><\/code> using <code><strong>${VARIABLE_NAME}<\/strong><\/code> syntax.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example <code>.env<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DATABASE_URL=mongodb:\/\/database:27017\/mydb\nNODE_ENV=development\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Reference in <code>docker-compose.yaml<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    environment:\n      - NODE_ENV=${NODE_ENV}\n      - DATABASE_URL=${DATABASE_URL}\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>&#8211; Depends_On<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code>depends_on<\/code> specifies dependencies between services, ensuring one service starts before another. It does not guarantee readiness (e.g., database connections), so you might need additional scripts or tools like <code>wait-for-it<\/code> for production setups.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  app:\n    depends_on:\n      - database\n  database:\n    image: mongo:latest\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4. <strong>Complete Example: React + Express + MongoDB<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a complete example combining React, Express, and MongoDB with Docker Compose:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>version: '3.8'\nservices:\n  frontend:\n    build:\n      context: .\/frontend\n      dockerfile: Dockerfile\n    ports:\n      - \"3001:3000\"\n    environment:\n      - REACT_APP_API_URL=http:\/\/backend:3000\n    depends_on:\n      - backend\n    networks:\n      - app-network\n\n  backend:\n    build:\n      context: .\/backend\n      dockerfile: Dockerfile\n    ports:\n      - \"3000:3000\"\n    environment:\n      - MONGO_URL=mongodb:\/\/database:27017\/mydb\n      - PORT=3000\n    depends_on:\n      - database\n    networks:\n      - app-network\n\n  database:\n    image: mongo:latest\n    ports:\n      - \"27017:27017\"\n    volumes:\n      - mongo-data:\/data\/db\n    networks:\n      - app-network\n\nnetworks:\n  app-network:\n    driver: bridge\n\nvolumes:\n  mongo-data:\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This setup:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Defines <code>frontend<\/code>, <code>backend<\/code>, and <code>database<\/code> services.<\/li>\n\n\n\n<li>Connects services on a shared network (<code>app-network<\/code>).<\/li>\n\n\n\n<li>Maps MongoDB data to a volume (<code>mongo-data<\/code>).<\/li>\n\n\n\n<li>Uses environment variables to configure each service.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So, what we have learnt from the above? Its an essential tool for local development and testing. Hope this helps to setup the local development setup based on the application need.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have read upto this and enjoying the detailing and content, you like to know how to create private repositories using nexus <a href=\"https:\/\/www.liainfraservices.com\/blog\/how-to-create-private-repositories-in-nexus\/\">https:\/\/www.liainfraservices.com\/blog\/how-to-create-private-repositories-in-nexus\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\"><\/span> <span class=\"rt-time\"> 4<\/span> <span class=\"rt-label rt-postfix\">min read<\/span><\/span>4,118 What is Docker Compose and How Does it Improve Local Development? Docker Compose simplifies multi-container application management by using a single YAML file to define and orchestrate This writeup<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[971],"tags":[],"class_list":["post-5112","post","type-post","status-publish","format-standard","hentry","category-devops"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to set up a Local development environment using docker compose - Blog | Liainfraservices<\/title>\n<meta name=\"description\" content=\"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.\" \/>\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.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set up a Local development environment using docker compose - Blog | Liainfraservices\" \/>\n<meta property=\"og:description\" content=\"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | Liainfraservices\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-08T09:55:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-25T07:28:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose.png\" \/>\n\t<meta property=\"og:image:width\" content=\"4213\" \/>\n\t<meta property=\"og:image:height\" content=\"3772\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Partho\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Partho\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/\"},\"author\":{\"name\":\"Partho\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\"},\"headline\":\"How to set up a Local development environment using docker compose\",\"datePublished\":\"2024-11-08T09:55:46+00:00\",\"dateModified\":\"2025-02-25T07:28:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/\"},\"wordCount\":736,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/docker-compose-1024x917.png\",\"articleSection\":[\"devops\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/\",\"name\":\"How to set up a Local development environment using docker compose - Blog | Liainfraservices\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/docker-compose-1024x917.png\",\"datePublished\":\"2024-11-08T09:55:46+00:00\",\"dateModified\":\"2025-02-25T07:28:07+00:00\",\"description\":\"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/docker-compose.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/docker-compose.png\",\"width\":4213,\"height\":3772},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/how-to-set-up-a-local-development-environment-using-docker-compose\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"devops\",\"item\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/category\\\/devops\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to set up a Local development environment using docker compose\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"name\":\"Blog | Liainfraservices\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#organization\",\"name\":\"Blog | Liainfraservices\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"contentUrl\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/lia-logo-b-e1635340384244.png\",\"width\":308,\"height\":96,\"caption\":\"Blog | Liainfraservices\"},\"image\":{\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.liainfraservices.com\\\/blog\\\/#\\\/schema\\\/person\\\/b5a729cb152dd3bc7f07550ca9d223e4\",\"name\":\"Partho\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g\",\"caption\":\"Partho\"},\"description\":\"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/partho-dev\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set up a Local development environment using docker compose - Blog | Liainfraservices","description":"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.","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.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/","og_locale":"en_US","og_type":"article","og_title":"How to set up a Local development environment using docker compose - Blog | Liainfraservices","og_description":"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.","og_url":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/","og_site_name":"Blog | Liainfraservices","article_published_time":"2024-11-08T09:55:46+00:00","article_modified_time":"2025-02-25T07:28:07+00:00","og_image":[{"width":4213,"height":3772,"url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose.png","type":"image\/png"}],"author":"Partho","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Partho","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#article","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/"},"author":{"name":"Partho","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4"},"headline":"How to set up a Local development environment using docker compose","datePublished":"2024-11-08T09:55:46+00:00","dateModified":"2025-02-25T07:28:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/"},"wordCount":736,"commentCount":0,"publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-1024x917.png","articleSection":["devops"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/","url":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/","name":"How to set up a Local development environment using docker compose - Blog | Liainfraservices","isPartOf":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#primaryimage"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#primaryimage"},"thumbnailUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose-1024x917.png","datePublished":"2024-11-08T09:55:46+00:00","dateModified":"2025-02-25T07:28:07+00:00","description":"Looking for a smooth local development experience with Docker Compose? Learn how to set up and manage multi-container applications with ease, using Docker Compose for seamless service orchestration, network management, and persistent data handling. Our complete guide covers everything you need to know to avoid common pitfalls and boost productivity.","breadcrumb":{"@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#primaryimage","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2024\/11\/docker-compose.png","width":4213,"height":3772},{"@type":"BreadcrumbList","@id":"https:\/\/www.liainfraservices.com\/blog\/how-to-set-up-a-local-development-environment-using-docker-compose\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.liainfraservices.com\/blog\/"},{"@type":"ListItem","position":2,"name":"devops","item":"https:\/\/www.liainfraservices.com\/blog\/category\/devops\/"},{"@type":"ListItem","position":3,"name":"How to set up a Local development environment using docker compose"}]},{"@type":"WebSite","@id":"https:\/\/www.liainfraservices.com\/blog\/#website","url":"https:\/\/www.liainfraservices.com\/blog\/","name":"Blog | Liainfraservices","description":"","publisher":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.liainfraservices.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.liainfraservices.com\/blog\/#organization","name":"Blog | Liainfraservices","url":"https:\/\/www.liainfraservices.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","contentUrl":"https:\/\/www.liainfraservices.com\/blog\/wp-content\/uploads\/2021\/10\/lia-logo-b-e1635340384244.png","width":308,"height":96,"caption":"Blog | Liainfraservices"},"image":{"@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.liainfraservices.com\/blog\/#\/schema\/person\/b5a729cb152dd3bc7f07550ca9d223e4","name":"Partho","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6c5fc8918cc5dbc844eccbeaaf854eef27d2c79ab17ff0022304f712805d6959?s=96&d=mm&r=g","caption":"Partho"},"description":"Partho Das, founder of Lia Infraservices, has 15+ years of expertise in cloud solutions, DevOps, and infrastructure security. He provides consultation on architecture planning, DevOps setup, Kubernetes, and cloud migrations. Partho holds multiple AWS and Azure certifications, along with CISCO CCNA &amp; CCNP. Connect on LinkedIn","sameAs":["https:\/\/www.linkedin.com\/in\/partho-dev\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/comments?post=5112"}],"version-history":[{"count":13,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5112\/revisions"}],"predecessor-version":[{"id":5126,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/posts\/5112\/revisions\/5126"}],"wp:attachment":[{"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/media?parent=5112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/categories?post=5112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.liainfraservices.com\/blog\/wp-json\/wp\/v2\/tags?post=5112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}