{"id":1290,"date":"2024-07-23T12:19:18","date_gmt":"2024-07-23T12:19:18","guid":{"rendered":"https:\/\/dockerpros.com\/?post_type=glossary&#038;p=1290"},"modified":"2024-07-23T12:22:33","modified_gmt":"2024-07-23T12:22:33","slug":"docker-compose-up-build","status":"publish","type":"glossary","link":"https:\/\/dockerpros.com\/it\/wiki\/docker-compose-up-build\/","title":{"rendered":"Docker Compose Avvia --build"},"content":{"rendered":"<h1>Understanding Docker Compose Up &#8211;build: An Advanced Guide<\/h1>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a powerful tool that simplifies the process of defining and running multi-container Docker applications. At its core, <code>docker-compose up --build<\/code> combines the functionality of building images and starting the application in a single command. This command is particularly useful in development workflows, where the need for iterative changes and immediate feedback is paramount. In this article, we will explore the intricacies of <code>docker-compose up --build<\/code>, its components, best practices, and common use cases, providing you with a comprehensive understanding of this essential Docker command.<\/p>\n<h2>What is Docker Compose?<\/h2>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is a tool for defining and running multi-container Docker applications. Using a <span class=\"glossaryai-tooltip glossary-term-690\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/yaml\/\" target=\"_blank\">YAML<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">YAML (YAML Ain't Markup Language) is a human-readable data serialization format commonly used for configuration files. It emphasizes simplicity and clarity, making it suitable for both developers and non-developers.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/yaml\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> file, developers can configure the services, networks, and volumes required for their application. The beauty of <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> lies in its ability to manage complex applications with multiple interconnected services, all while keeping the configuration concise and human-readable.<\/p>\n<p>With <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, developers can easily create, start, stop, and manage multiple containers as a single unit, allowing for streamlined development, testing, and production workflows. The primary command for managing <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is <code>docker-compose<\/code> followed by various subcommands such as <code>up<\/code>, <code>down<\/code>, <code>build<\/code>, and others.<\/p>\n<h2>The Role of <code>docker-compose up<\/code><\/h2>\n<p>The <code>docker-compose up<\/code> command is fundamental to the operation of <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. It performs several critical functions:<\/p>\n<ol>\n<li><strong>Building Images<\/strong>: If the images specified in the <code>docker-compose.yml<\/code> file do not exist, <code>docker-compose up<\/code> will build them from the specified <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<li><strong>Starting Services<\/strong>: It starts all the services defined in the configuration file, creating the necessary containers.<\/li>\n<li><strong>Creating Networks<\/strong>: It automatically creates networks for the services to communicate with each other.<\/li>\n<li><strong>Attaching Logs<\/strong>: It attaches to the log output of the services, allowing developers to monitor the application in real-time.<\/li>\n<li><strong>Handling Dependencies<\/strong>: It manages <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> dependencies, ensuring that dependent services are started in the correct order.<\/li>\n<\/ol>\n<h2>The Significance of the <code>--build<\/code> Flag<\/h2>\n<p>The <code>--build<\/code> flag enhances the <code>docker-compose up<\/code> command by explicitly forcing <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to build images before starting the services. This is particularly useful in scenarios where the underlying code or configuration has changed and requires a fresh build of the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to reflect those changes. <\/p>\n<p>If you were to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <code>docker-compose up<\/code> without the <code>--build<\/code> flag, <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> would use existing images if they are present, even if the source code or dependencies have changed. This could lead to inconsistencies and bugs that are difficult to diagnose.<\/p>\n<h3>Syntax of the Command<\/h3>\n<p>The syntax for using the <code>docker-compose up --build<\/code> command is straightforward:<\/p>\n<pre><code class=\"language-bash\">docker-compose up --build [OPTIONS] [<span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">SERVICE<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>...]<\/code><\/pre>\n<ul>\n<li><code>OPTIONS<\/code>: Optional flags that can modify the behavior of the command, such as <code>-d<\/code> for detached mode.<\/li>\n<li><code><span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">SERVICE<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code>: Optional specification of one or more services to manage. If omitted, all services defined in the <code>docker-compose.yml<\/code> file will be started.<\/li>\n<\/ul>\n<h2>Practical Example: Using <code>docker-compose up --build<\/code><\/h2>\n<p>To illustrate the usage of <code>docker-compose up --build<\/code>, let\u2019s consider a simple web application consisting of a frontend and a backend <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. We will define these services in a <code>docker-compose.yml<\/code> file.<\/p>\n<h3>Step 1: Create a Sample Application<\/h3>\n<h4>Directory Structure<\/h4>\n<p>Assume we have the following directory structure:<\/p>\n<pre><code>myapp\/\n\u2502\n\u251c\u2500\u2500 backend\/\n\u2502   \u251c\u2500\u2500 Dockerfile\n\u2502   \u251c\u2500\u2500 app.py\n\u2502   \u2514\u2500\u2500 requirements.txt\n\u2502\n\u251c\u2500\u2500 frontend\/\n\u2502   \u251c\u2500\u2500 Dockerfile\n\u2502   \u251c\u2500\u2500 index.html\n\u2502   \u2514\u2500\u2500 app.js\n\u2502\n\u2514\u2500\u2500 docker-compose.yml<\/code><\/pre>\n<h4>Sample Dockerfiles<\/h4>\n<p><strong>Backend <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> (<code>backend\/Dockerfile<\/code>):<\/strong><\/p>\n<pre><code class=\"language-dockerfile\">FROM python:3.9\n\nWORKDIR \/app\n\nCOPY requirements.txt .\n\nRUN pip install --no-cache-dir -r requirements.txt\n\nCOPY . .\n\nCMD [\"python\", \"app.py\"]<\/code><\/pre>\n<p><strong>Frontend <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> (<code>frontend\/Dockerfile<\/code>):<\/strong><\/p>\n<pre><code class=\"language-dockerfile\">FROM nginx:alpine\n\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/copy\/\" target=\"_blank\">COPY<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">COPY is a command in computer programming and data management that facilitates the duplication of files or data from one location to another, ensuring data integrity and accessibility.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> index.html \/usr\/share\/nginx\/html\/index.html\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/copy\/\" target=\"_blank\">COPY<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">COPY is a command in computer programming and data management that facilitates the duplication of files or data from one location to another, ensuring data integrity and accessibility.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> app.js \/usr\/share\/nginx\/html\/app.js<\/code><\/pre>\n<h3>Step 2: Create the <code>docker-compose.yml<\/code> File<\/h3>\n<p>Now, let\u2019s define our services in the <code>docker-compose.yml<\/code> file:<\/p>\n<pre><code class=\"language-yaml\">version: '3.8'\n\nservices:\n  backend:\n    build: .\/backend\n    ports:\n      - \"5000:5000\"\n\n  frontend:\n    build: .\/frontend\n    ports:\n      - \"80:80\"\n    depends_on:\n      - backend<\/code><\/pre>\n<h3>Step 3: Run the Command<\/h3>\n<p>To build the images and start the containers, navigate to the <code>myapp<\/code> directory and <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-bash\">docker-compose up --build<\/code><\/pre>\n<p>This command will:<\/p>\n<ol>\n<li>Build the images for the <code>backend<\/code> and <code>frontend<\/code> services based on their respective Dockerfiles.<\/li>\n<li>Start the containers for both services and <span class=\"glossaryai-tooltip glossary-term-676\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/expose\/\" target=\"_blank\">expose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"EXPOSE\" is a powerful tool used in various fields, including cybersecurity and software development, to identify vulnerabilities and shortcomings in systems, ensuring robust security measures are implemented.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/expose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> their ports to the host.<\/li>\n<\/ol>\n<h3>Step 4: Making Changes and Rebuilding<\/h3>\n<p>Let&#8217;s say we want to make a change in the <code>app.py<\/code> file of the backend <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. After editing the file, you would <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-bash\">docker-compose up --build<\/code><\/pre>\n<p>This ensures that the backend <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is rebuilt with the latest changes before being restarted.<\/p>\n<h2>Advanced Options with <code>docker-compose up --build<\/code><\/h2>\n<h3>Using the <code>-d<\/code> Flag<\/h3>\n<p>By default, <code>docker-compose up --build<\/code> runs in the foreground, attaching to the log output of the services. If you want to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> the services in detached mode (in the background), you can use the <code>-d<\/code> flag:<\/p>\n<pre><code class=\"language-bash\">docker-compose up --build -d<\/code><\/pre>\n<p>In detached mode, you can continue using your terminal while the services <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in the background. To view logs later, you can use:<\/p>\n<pre><code class=\"language-bash\">docker-compose logs<\/code><\/pre>\n<h3>Controlling Specific Services<\/h3>\n<p>If you only want to rebuild and start a specific <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, you can specify the <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> name at the end of the command:<\/p>\n<pre><code class=\"language-bash\">docker-compose up --build backend<\/code><\/pre>\n<p>This command will rebuild the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> for the <code>backend<\/code> <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> and start it while leaving the <code>frontend<\/code> <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> unchanged.<\/p>\n<h3>Handling Environment Variables<\/h3>\n<p><span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> allows you to define environment variables in your <code>docker-compose.yml<\/code> file or using an <code>.env<\/code> file. When using <code>docker-compose up --build<\/code>, make sure to account for any environment variables needed for the build process. A typical way to include environment variables in your <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Dockerfile is a script containing a series of instructions to automate the creation of Docker images. It specifies the base image, application dependencies, and configuration, facilitating consistent deployment across environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> is:<\/p>\n<pre><code class=\"language-dockerfile\"><span class=\"glossaryai-tooltip glossary-term-679\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/arg\/\" target=\"_blank\">ARG<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">ARG is a directive used within Dockerfiles to define build-time variables that allow you to parameterize your builds. These variables can influence how an image is constructed, enabling developers to create more flexible and reusable Docker images.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/arg\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> NODE_ENV\n<span class=\"glossaryai-tooltip glossary-term-671\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/env\/\" target=\"_blank\">ENV<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">ENV, or Environmental Variables, are crucial in software development and system configuration. They store dynamic values that affect the execution environment, enabling flexible application behavior across different platforms.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/env\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> NODE_ENV=${NODE_ENV}<\/code><\/pre>\n<p>You can pass arguments during the build process using:<\/p>\n<pre><code class=\"language-bash\">docker-compose build --build-arg NODE_ENV=production<\/code><\/pre>\n<h2>Best Practices for Using <code>docker-compose up --build<\/code><\/h2>\n<ol>\n<li>\n<p><strong>Use Version Control<\/strong>: Always store your <code>docker-compose.yml<\/code> files and Dockerfiles in version control systems like Git. This way, you can easily track changes and roll back if necessary.<\/p>\n<\/li>\n<li>\n<p><strong>Keep Images Small<\/strong>: Optimize your Dockerfiles by minimizing the number of layers and keeping the final images small. This will speed up the building process and reduce deployment times.<\/p>\n<\/li>\n<li>\n<p><strong>Use <code>.dockerignore<\/code><\/strong>: Include a <code>.dockerignore<\/code> file in your <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> directories to prevent unnecessary files from being included in the build context. This can significantly reduce build times and the size of the resulting <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\" target=\"_blank\">image<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">An image is a visual representation of an object or scene, typically composed of pixels in digital formats. It can convey information, evoke emotions, and facilitate communication across various media.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<\/li>\n<li>\n<p><strong>Leverage Caching<\/strong>: Docker uses caching to speed up the build process. Organize your Dockerfiles such that the most frequently changed lines come last. This way, Docker can reuse cached layers for unchanged lines.<\/p>\n<\/li>\n<li>\n<p><strong>Monitor Resource Usage<\/strong>: When running multiple services, ensure that your machine has enough resources (CPU, memory) to handle the load. Tools like <code>docker stats<\/code> can help you monitor the resource usage of your containers.<\/p>\n<\/li>\n<li>\n<p><strong>Use <span class=\"glossaryai-tooltip glossary-term-1271\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose-override-files\/\" target=\"_blank\">Docker Compose Override Files<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose override files allow users to customize and extend the base configuration defined in a `docker-compose.yml` file. By creating a `docker-compose.override.yml`, developers can specify additional services, modify existing ones, or override settings, enabling flexible deployment scenarios without altering the primary configuration. This feature enhances collaboration and environment-specific setups, streamlining development and production workflows.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose-override-files\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/strong>: In development, you might want different configurations than in production. Use <code>docker-compose.override.yml<\/code> to define settings for development environments, which <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> automatically picks up.<\/p>\n<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>The <code>docker-compose up --build<\/code> command is a cornerstone of modern containerized application development, providing a seamless way to build and <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\" target=\"_blank\">run<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">\"RUN\" refers to a command in various programming languages and operating systems to execute a specified program or script. It initiates processes, providing a controlled environment for task execution.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> multi-container applications in a single step. By understanding its functionality, options, and best practices, you can leverage <span class=\"glossaryai-tooltip glossary-term-654\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\" target=\"_blank\">Docker Compose<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Compose is a tool for defining and running multi-container Docker applications using a YAML file. It simplifies deployment, configuration, and orchestration of services, enhancing development efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to streamline your development workflows, enhance productivity, and maintain consistency across environments.<\/p>\n<p>As you delve deeper into Docker and <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/container\/\" target=\"_blank\">container<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Containers are lightweight, portable units that encapsulate software and its dependencies, enabling consistent execution across different environments. They leverage OS-level virtualization for efficiency.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <span class=\"glossaryai-tooltip glossary-term-657\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/orchestration\/\" target=\"_blank\">orchestration<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Orchestration refers to the automated management and coordination of complex systems and services. It optimizes processes by integrating various components, ensuring efficient operation and resource utilization.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/orchestration\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, remember that effective use of <code>docker-compose up --build<\/code> can significantly impact the efficiency and reliability of your applications. With its ability to facilitate iterative development, ensure fresh builds, and simplify complex <span class=\"glossaryai-tooltip glossary-term-681\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\" target=\"_blank\">service<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Service refers to the act of providing assistance or support to fulfill specific needs or requirements. In various domains, it encompasses customer service, technical support, and professional services, emphasizing efficiency and user satisfaction.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/service\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> management, this command is indispensable for any developer working with Docker.<\/p>","protected":false},"excerpt":{"rendered":"<p>Il comando `docker-compose up --build` viene utilizzato per costruire le immagini prima di avviare i servizi definiti in un file `docker-compose.yml`. Ci\u00f2 garantisce che eventuali modifiche apportate al <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\" target=\"_blank\">Dockerfile<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Un Dockerfile \u00e8 uno script contenente una serie di istruzioni per automatizzare la creazione di immagini Docker. Specifica l'immagine di base, le dipendenze dell'applicazione e la configurazione, facilitando la distribuzione coerente in diversi ambienti.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/it\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> o il codice dell'applicazione vengono riflessi nei contenitori.<\/p>","protected":false},"author":1,"featured_media":1897,"parent":0,"template":"","glossary-cat":[],"class_list":["post-1290","glossary","type-glossary","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Docker Compose Up -build - Dockerpros<\/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:\/\/dockerpros.com\/it\/wiki\/docker-compose-up-build\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Docker Compose Up -build - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"The command `docker-compose up --build` is used to build images before starting the services defined in a `docker-compose.yml` file. This ensures that any changes in the Dockerfile or application code are reflected in the containers.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/it\/wiki\/docker-compose-up-build\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-23T12:22:33+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tempo di lettura stimato\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/\",\"url\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/\",\"name\":\"Docker Compose Up -build - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg\",\"datePublished\":\"2024-07-23T12:19:18+00:00\",\"dateModified\":\"2024-07-23T12:22:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg\",\"width\":800,\"height\":600,\"caption\":\"docker-compose-up-build-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Glossary\",\"item\":\"https:\/\/dockerpros.com\/fr\/wiki\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Docker Compose Up &#8211;build\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dockerpros.com\/#website\",\"url\":\"https:\/\/dockerpros.com\/\",\"name\":\"Dockerpros\",\"description\":\"DockerPros \u2013 Your Ultimate Docker Resource Hub\",\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dockerpros.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dockerpros.com\/#organization\",\"name\":\"Dockerpros\",\"url\":\"https:\/\/dockerpros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png\",\"width\":532,\"height\":114,\"caption\":\"Dockerpros\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Docker Compose Up -build - Dockerpros","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:\/\/dockerpros.com\/it\/wiki\/docker-compose-up-build\/","og_locale":"it_IT","og_type":"article","og_title":"Docker Compose Up -build - Dockerpros","og_description":"The command `docker-compose up --build` is used to build images before starting the services defined in a `docker-compose.yml` file. This ensures that any changes in the Dockerfile or application code are reflected in the containers.","og_url":"https:\/\/dockerpros.com\/it\/wiki\/docker-compose-up-build\/","og_site_name":"Dockerpros","article_modified_time":"2024-07-23T12:22:33+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Tempo di lettura stimato":"6 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/","url":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/","name":"Docker Compose Up -build - Dockerpros","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg","datePublished":"2024-07-23T12:19:18+00:00","dateModified":"2024-07-23T12:22:33+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/"]}]},{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/docker-compose-up-build_1290.jpg","width":800,"height":600,"caption":"docker-compose-up-build-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/wiki\/docker-compose-up-build\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"Glossary","item":"https:\/\/dockerpros.com\/fr\/wiki\/"},{"@type":"ListItem","position":3,"name":"Docker Compose Up &#8211;build"}]},{"@type":"WebSite","@id":"https:\/\/dockerpros.com\/#website","url":"https:\/\/dockerpros.com\/","name":"Esperti Docker","description":"DockerPros \u2013 Il tuo punto di riferimento definitivo per Docker","publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dockerpros.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/dockerpros.com\/#organization","name":"Esperti Docker","url":"https:\/\/dockerpros.com\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/Dockerpros_logo_blanco.png","width":532,"height":114,"caption":"Dockerpros"},"image":{"@id":"https:\/\/dockerpros.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/glossary\/1290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/glossary"}],"about":[{"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/types\/glossary"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/glossary\/1290\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/media\/1897"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/media?parent=1290"}],"wp:term":[{"taxonomy":"glossary-cat","embeddable":true,"href":"https:\/\/dockerpros.com\/it\/wp-json\/wp\/v2\/glossary-cat?post=1290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}