{"id":231,"date":"2024-07-21T11:43:49","date_gmt":"2024-07-21T11:43:49","guid":{"rendered":"https:\/\/dockerpros.com\/?p=231"},"modified":"2024-07-21T11:43:49","modified_gmt":"2024-07-21T11:43:49","slug":"how-do-i-use-docker-with-gitlab-ci-cd","status":"publish","type":"post","link":"https:\/\/dockerpros.com\/es\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/","title":{"rendered":"Para utilizar Docker con GitLab CI\/CD, sigue estos pasos:\n\n1. **Configurar el archivo `.gitlab-ci.yml`**:\n   - Define las etapas de tu pipeline (por ejemplo, `build`, `test`, `deploy`).\n   - Utiliza la imagen de Docker en tu pipeline para construir y ejecutar contenedores.\n\n2. **Usar Docker in Docker (DinD)**:\n   - Si necesitas ejecutar comandos de Docker dentro de tu pipeline, puedes usar la imagen `docker:dind` (Docker in Docker).\n   - Aseg\u00farate de configurar el servicio `docker:dind` en tu archivo `.gitlab-ci.yml`.\n\n3. **Construir y empujar im\u00e1genes Docker**:\n   - Utiliza comandos como `docker build` para construir im\u00e1genes.\n   - Usa `docker push` para empujar las im\u00e1genes a un registro de contenedores (por ejemplo, Docker Hub, GitLab Container Registry).\n\n4. **Ejecutar contenedores**:\n   - Utiliza `docker run` para ejecutar contenedores en tu pipeline.\n   - Aseg\u00farate de que los contenedores tengan acceso a los recursos necesarios (por ejemplo, vol\u00famenes, redes).\n\n5. **Configurar variables de entorno**:\n   - Define variables de entorno en GitLab CI\/CD para almacenar informaci\u00f3n sensible como contrase\u00f1as o tokens de acceso.\n\n6. **Utilizar Docker Compose**:\n   - Si tu aplicaci\u00f3n utiliza m\u00faltiples contenedores, puedes usar Docker Compose para definir y ejecutarlos.\n\n7. **Optimizar el pipeline**:\n   - Utiliza cach\u00e9 para acelerar el proceso de construcci\u00f3n.\n   - Divide el pipeline en etapas para mejorar la eficiencia.\n\n8. **Monitorear y depurar**:\n   - Utiliza las herramientas de monitoreo de GitLab CI\/CD para rastrear el progreso de tu pipeline.\n   - Revisa los registros de ejecuci\u00f3n para identificar y solucionar problemas.\n\n9. **Seguridad**:\n   - Aseg\u00farate de que las im\u00e1genes Docker utilizadas sean seguras y est\u00e9n actualizadas.\n   - Utiliza pol\u00edticas de seguridad para restringir el acceso a recursos sensibles.\n\n10. **Documentaci\u00f3n**:\n    - Documenta tu configuraci\u00f3n de Docker y GitLab CI\/CD para facilitar el mantenimiento y la colaboraci\u00f3n.\n\nRecuerda que la configuraci\u00f3n espec\u00edfica puede variar seg\u00fan las necesidades de tu proyecto. Consulta la documentaci\u00f3n de GitLab CI\/CD y Docker para obtener m\u00e1s detalles y ejemplos."},"content":{"rendered":"<h1>How to Use Docker with GitLab CI\/CD: A Comprehensive Guide<\/h1>\n<p>In the ever-evolving world of software development, Continuous Integration (CI) and Continuous Deployment (CD) have become indispensable practices that streamline workflows, enhance collaboration, and improve code quality. GitLab CI\/CD is one such tool that allows developers to automate the building, testing, and deployment of applications. When combined with Docker, a platform for developing, shipping, and running applications in containers, GitLab CI\/CD becomes a powerful ally in the development lifecycle. This article aims to provide a detailed overview of how to integrate Docker with GitLab CI\/CD, along with best practices and advanced techniques.<\/p>\n<h2>Understanding GitLab CI\/CD and Docker<\/h2>\n<p>Before delving into the integration process, let&#8217;s understand the core components:<\/p>\n<h3>What is GitLab CI\/CD?<\/h3>\n<p>GitLab CI\/CD is a built-in feature of GitLab that allows you to automate the software development process. It provides pipelines, which are defined workflows for building, testing, and deploying code. Pipelines consist of various stages and jobs, where each job runs in a separate environment known as a runner.<\/p>\n<h3>What is Docker?<\/h3>\n<p>Docker is a platform that uses containerization to package applications and their dependencies into standardized units called containers. Containers are lightweight, portable, and can be <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> on any system that supports Docker, ensuring consistent environments across development, testing, and production.<\/p>\n<h3>Why Combine GitLab CI\/CD with Docker?<\/h3>\n<p>Combining GitLab CI\/CD with Docker brings multiple advantages:<\/p>\n<ul>\n<li><strong>Environment Consistency<\/strong>: Docker ensures that the application runs the same way regardless of the environment, minimizing the &quot;it works on my machine&quot; dilemma.<\/li>\n<li><strong>Isolation<\/strong>: Each CI\/CD job can <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in its own Docker <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, eliminating conflicts between dependencies.<\/li>\n<li><strong>Scalability<\/strong>: Docker containers can be easily scaled up or down, making it easier to manage resources during the CI\/CD process.<\/li>\n<li><strong>Speed<\/strong>: Docker images can be built and deployed in a fraction of the time compared to traditional methods, allowing for faster iterations.<\/li>\n<\/ul>\n<h2>Setting Up GitLab CI\/CD with Docker<\/h2>\n<h3>Prerequisites<\/h3>\n<p>Before we start, ensure you have the following:<\/p>\n<ol>\n<li>A GitLab account and access to a GitLab <span class=\"glossaryai-tooltip glossary-term-659\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\" target=\"_blank\">repository<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A repository is a centralized location where data, code, or documents are stored, managed, and maintained. It facilitates version control, collaboration, and efficient resource sharing among users.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\">More \u00bb<\/a><\/span><\/span><span class=\"gai-tooltip-video-wrapper\"><span class=\"gai-tooltip-video\" data-src=\"https:\/\/www.youtube.com\/embed\/_OXj8BGxNPY?rel=0&#038;modestbranding=1\"><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<li>A basic understanding of Docker and GitLab CI\/CD concepts.<\/li>\n<li>Docker installed on your local machine for building images.<\/li>\n<\/ol>\n<h3>Step 1: Create a <code>.gitlab-ci.yml<\/code> File<\/h3>\n<p>The <code>.gitlab-ci.yml<\/code> file is the cornerstone of GitLab CI\/CD. This <span class=\"glossaryai-tooltip glossary-term-690\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/yaml\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> file defines the pipeline configuration, including the stages, jobs, and scripts to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/p>\n<ol>\n<li>In your GitLab <span class=\"glossaryai-tooltip glossary-term-659\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\" target=\"_blank\">repository<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A repository is a centralized location where data, code, or documents are stored, managed, and maintained. It facilitates version control, collaboration, and efficient resource sharing among users.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\">More \u00bb<\/a><\/span><\/span><span class=\"gai-tooltip-video-wrapper\"><span class=\"gai-tooltip-video\" data-src=\"https:\/\/www.youtube.com\/embed\/_OXj8BGxNPY?rel=0&#038;modestbranding=1\"><\/span><\/span><\/span><\/span><\/span>, create a new file named <code>.gitlab-ci.yml<\/code>.<\/li>\n<li>Define the stages of your pipeline. Common stages include <code>build<\/code>, <code>test<\/code>, and <code>deploy<\/code>.<\/li>\n<\/ol>\n<p>Here\u2019s a simple example:<\/p>\n<pre><code class=\"language-yaml\">stages:\n  - build\n  - test\n  - deploy<\/code><\/pre>\n<h3>Step 2: Build Your Docker Image<\/h3>\n<p>Inside your <code>.gitlab-ci.yml<\/code> file, you will need to define a job that builds your Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. <\/p>\n<pre><code class=\"language-yaml\">build:\n  stage: build\n  <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker build -t myapp:latest .<\/code><\/pre>\n<p>In this example:<\/p>\n<ul>\n<li>We specify <code>docker:latest<\/code> as the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> for the job.<\/li>\n<li><code>docker:dind<\/code> (Docker-in-Docker) is used to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> Docker commands.<\/li>\n<li>The <code>docker build<\/code> command helps create a Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> tagged as <code>myapp:latest<\/code>.<\/li>\n<\/ul>\n<h3>Step 3: Run Tests in a Docker Container<\/h3>\n<p>After building your Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, it is crucial to test it to ensure that everything functions as expected. You can define a <code>test<\/code> job in your <code>.gitlab-ci.yml<\/code> file:<\/p>\n<pre><code class=\"language-yaml\">test:\n  stage: test\n  <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: myapp:latest\n  script:\n    - docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> --rm myapp:latest .\/run_tests.sh<\/code><\/pre>\n<p>In this example:<\/p>\n<ul>\n<li>The job uses the freshly built Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<li>The <code>docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span><\/code> command executes the tests inside the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<\/ul>\n<h3>Step 4: Deploying Using Docker<\/h3>\n<p>Once your application has been built and tested, it&#8217;s time to deploy it. You can define a <code>deploy<\/code> job, which can also utilize Docker.<\/p>\n<pre><code class=\"language-yaml\">deploy:\n  stage: deploy\n  <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: docker:latest\n  script:\n    - docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> -d -p 80:80 myapp:latest<\/code><\/pre>\n<p>This job deploys your application by running the Docker <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in detached mode and mapping <span class=\"glossaryai-tooltip glossary-term-677\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/port\/\" target=\"_blank\">port<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A PORT is a communication endpoint in a computer network, defined by a numerical identifier. It facilitates the routing of data to specific applications, enhancing system functionality and security.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/port\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> 80 of the <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to <span class=\"glossaryai-tooltip glossary-term-677\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/port\/\" target=\"_blank\">port<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A PORT is a communication endpoint in a computer network, defined by a numerical identifier. It facilitates the routing of data to specific applications, enhancing system functionality and security.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/port\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> 80 of the host.<\/p>\n<h3>Step 5: Using Environment Variables<\/h3>\n<p>For sensitive information such as <span class=\"glossaryai-tooltip glossary-term-1249\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/api\/\" target=\"_blank\">API<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">An API, or Application Programming Interface, enables software applications to communicate and interact with each other. It defines protocols and tools for building software and facilitating integration.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/api\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> keys, database passwords, or any other confidential data, it is essential to use environment variables. GitLab CI\/CD provides a way to set these variables in the CI\/CD settings of your project.<\/p>\n<ol>\n<li>Navigate to your GitLab <span class=\"glossaryai-tooltip glossary-term-659\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\" target=\"_blank\">repository<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A repository is a centralized location where data, code, or documents are stored, managed, and maintained. It facilitates version control, collaboration, and efficient resource sharing among users.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/repository\/\">More \u00bb<\/a><\/span><\/span><span class=\"gai-tooltip-video-wrapper\"><span class=\"gai-tooltip-video\" data-src=\"https:\/\/www.youtube.com\/embed\/_OXj8BGxNPY?rel=0&#038;modestbranding=1\"><\/span><\/span><\/span><\/span><\/span>.<\/li>\n<li>Go to <strong>Settings<\/strong> -&gt; <strong>CI\/CD<\/strong> -&gt; <strong>Variables<\/strong>.<\/li>\n<li><span class=\"glossaryai-tooltip glossary-term-674\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/add\/\" target=\"_blank\">Add<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The ADD instruction in Docker is a command used in Dockerfiles to copy files and directories from a host machine into a Docker image during the build process. It not only facilitates the transfer of local files but also provides additional functionality, such as automatically extracting compressed files and fetching remote files via HTTP or HTTPS.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/add\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> your environment variables securely.<\/li>\n<\/ol>\n<p>You can access these variables in your <code>.gitlab-ci.yml<\/code> file using the syntax <code>$VARIABLE_NAME<\/code>.<\/p>\n<h3>Step 6: Caching Docker Layers<\/h3>\n<p>Docker images can take time to build, especially if they have many dependencies. To speed up the process, you can cache the Docker layers. Modify your <code>.gitlab-ci.yml<\/code> file to utilize caching:<\/p>\n<pre><code class=\"language-yaml\">cache:\n  key: $CI_COMMIT_REF_SLUG\n  paths:\n    - .docker\/cache\n\nbuild:\n  stage: build\n  <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker build --cache-from myapp:latest -t myapp:latest .<\/code><\/pre>\n<p>By caching the Docker layers, subsequent builds can reuse previously built layers, drastically reducing build time.<\/p>\n<h2>Advanced Techniques and Best Practices<\/h2>\n<h3>1. Multi-Stage Builds<\/h3>\n<p>Multi-stage builds are a powerful feature of Docker that allow you to optimize your images. By breaking your <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> into multiple stages, you can keep only the necessary files in the final <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>, thus reducing its size.<\/p>\n<p>Here\u2019s a simplified example:<\/p>\n<pre><code class=\"language-dockerfile\"># Stage 1: Build the application\nFROM <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\" target=\"_blank\">node<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Node, or Node.js, is a JavaScript runtime built on Chrome's V8 engine, enabling server-side scripting. It allows developers to build scalable network applications using asynchronous, event-driven architecture.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:14 AS builder\n<span class=\"glossaryai-tooltip glossary-term-675\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/workdir\/\" target=\"_blank\">WORKDIR<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The `WORKDIR` instruction in Dockerfile sets the working directory for subsequent instructions. It simplifies path management, as all relative paths will be resolved from this directory, enhancing build clarity.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/workdir\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> \/app\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> package.json .\/\n<span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> npm install\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> . .\n<span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> npm <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> build\n\n# Stage 2: Prepare the production image\nFROM nginx:alpine\n<span class=\"glossaryai-tooltip glossary-term-673\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/copy\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> --from=builder \/app\/build \/usr\/share\/nginx\/html<\/code><\/pre>\n<p>This <span class=\"glossaryai-tooltip glossary-term-652\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/dockerfile\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> example builds a <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\" target=\"_blank\">Node<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Node, or Node.js, is a JavaScript runtime built on Chrome's V8 engine, enabling server-side scripting. It allows developers to build scalable network applications using asynchronous, event-driven architecture.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.js application in the first stage and serves it using Nginx in the second stage. <\/p>\n<h3>2. Use Specific Image Tags<\/h3>\n<p>Using <code>latest<\/code> can lead to inconsistencies, especially when different jobs may pull different versions of the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>. Instead, use specific tags for your Docker images to ensure you\u2019re always deploying the same version.<\/p>\n<h3>3. Parallel Jobs<\/h3>\n<p>GitLab CI\/CD enables you to <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> jobs in parallel, which can significantly speed up your pipeline. You can specify parallel jobs by using the <code>parallel<\/code> keyword in your <code>.gitlab-ci.yml<\/code>.<\/p>\n<pre><code class=\"language-yaml\">test:\n  stage: test\n  parallel:\n    matrix:\n      - NODE_VERSION: [14, 16, 18]\n  script:\n    - docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> --rm myapp:$NODE_VERSION .\/run_tests.sh<\/code><\/pre>\n<p>In this example, tests will <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in parallel across different <span class=\"glossaryai-tooltip glossary-term-684\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\" target=\"_blank\">Node<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Node, or Node.js, is a JavaScript runtime built on Chrome's V8 engine, enabling server-side scripting. It allows developers to build scalable network applications using asynchronous, event-driven architecture.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/node\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>.js versions.<\/p>\n<h3>4. Utilize Docker Registry<\/h3>\n<p>A <span class=\"glossaryai-tooltip glossary-term-736\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/docker-registry\/\" target=\"_blank\">Docker registry<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A Docker Registry is a storage and distribution system for Docker images. It allows developers to upload, manage, and share container images, facilitating efficient deployment in diverse environments.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/docker-registry\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> (like <span class=\"glossaryai-tooltip glossary-term-653\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/docker-hub\/\" target=\"_blank\">Docker Hub<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">Docker Hub is a cloud-based repository for storing and sharing container images. It facilitates version control, collaborative development, and seamless integration with Docker CLI for efficient container management.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/docker-hub\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> or GitLab <span class=\"glossaryai-tooltip glossary-term-650\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/container\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> <span class=\"glossaryai-tooltip glossary-term-658\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/registry\/\" target=\"_blank\">Registry<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A registry is a centralized database that stores information about various entities, such as software installations, system configurations, or user data. It serves as a crucial component for system management and configuration.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/registry\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>) allows you to store and manage your Docker images. Instead of building the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> every time, you can push the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> to the <span class=\"glossaryai-tooltip glossary-term-658\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/registry\/\" target=\"_blank\">registry<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A registry is a centralized database that stores information about various entities, such as software installations, system configurations, or user data. It serves as a crucial component for system management and configuration.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/registry\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> after a successful build and then pull it during deployment.<\/p>\n<p><span class=\"glossaryai-tooltip glossary-term-674\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/add\/\" target=\"_blank\">Add<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">The ADD instruction in Docker is a command used in Dockerfiles to copy files and directories from a host machine into a Docker image during the build process. It not only facilitates the transfer of local files but also provides additional functionality, such as automatically extracting compressed files and fetching remote files via HTTP or HTTPS.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/add\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> the following to your build job:<\/p>\n<pre><code class=\"language-yaml\">build:\n  stage: build\n  script:\n    - docker build -t myapp:$CI_COMMIT_SHORT_SHA .\n    - docker push myapp:$CI_COMMIT_SHORT_SHA<\/code><\/pre>\n<p>Then, for deployment, pull the <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span>:<\/p>\n<pre><code class=\"language-yaml\">deploy:\n  script:\n    - docker pull myapp:$CI_COMMIT_SHORT_SHA\n    - docker <span class=\"glossaryai-tooltip glossary-term-672\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/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\/es\/wiki\/run\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> -d -p 80:80 myapp:$CI_COMMIT_SHORT_SHA<\/code><\/pre>\n<h3>5. Monitoring and Logging<\/h3>\n<p>It&#8217;s essential to monitor your Docker containers and collect logs for debugging and performance analysis. Use tools like Prometheus for monitoring and ELK <span class=\"glossaryai-tooltip glossary-term-682\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/stack\/\" target=\"_blank\">stack<\/a><\/span><span class=\"gai-content-hidden glossaryai-tooltip-content\"><span class=\"gai-tooltip-body\"><span class=\"glossaryai-tooltip-text\">A stack is a data structure that operates on a Last In, First Out (LIFO) principle, where the most recently added element is the first to be removed. It supports two primary operations: push and pop.<span class=\"glossaryai-more-link\"> <a href=\"https:\/\/dockerpros.com\/es\/wiki\/stack\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> (Elasticsearch, Logstash, Kibana) for logging solutions.<\/p>\n<h2>Conclusion<\/h2>\n<p>Integrating Docker with GitLab CI\/CD can significantly enhance your software development workflow. By leveraging Docker&#8217;s containerization capabilities, you can create consistent, isolated environments that facilitate faster builds, tests, and deployments. <\/p>\n<p>In this article, we&#8217;ve covered the basics of setting up Docker in GitLab CI\/CD, from building and testing to deploying applications. We&#8217;ve also explored advanced techniques such as multi-stage builds, caching, and using Docker registries. By adopting these practices, you can ensure a more efficient, reliable, and scalable development process.<\/p>\n<p>As you continue to explore CI\/CD and Docker, remember that continuous improvement is key. Experiment with new tools, techniques, and best practices to refine your workflows and ultimately produce higher-quality software. Happy coding!<\/p>","protected":false},"excerpt":{"rendered":"<p>To use Docker with GitLab CI\/CD, define a Docker <span class=\"glossaryai-tooltip glossary-term-651\"><span class=\"glossaryai-link\"><a href=\"https:\/\/dockerpros.com\/es\/wiki\/image\/\" target=\"_blank\">imagen<\/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\/es\/wiki\/image\/\">More \u00bb<\/a><\/span><\/span><\/span><\/span><\/span> in your `.gitlab-ci.yml` file. This enables containerized builds and tests, ensuring consistency across environments.<\/p>","protected":false},"author":1,"featured_media":274,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-integrations-and-use-cases"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How do I use Docker with GitLab CI\/CD? - 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\/es\/integraciones-y-casos-de-uso\/how-do-i-use-docker-with-gitlab-ci-cd\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How do I use Docker with GitLab CI\/CD? - Dockerpros\" \/>\n<meta property=\"og:description\" content=\"To use Docker with GitLab CI\/CD, define a Docker image in your `.gitlab-ci.yml` file. This enables containerized builds and tests, ensuring consistency across environments.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dockerpros.com\/es\/integraciones-y-casos-de-uso\/how-do-i-use-docker-with-gitlab-ci-cd\/\" \/>\n<meta property=\"og:site_name\" content=\"Dockerpros\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-21T11:43:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.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=\"author\" content=\"dockerpros\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"dockerpros\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/\"},\"author\":{\"name\":\"dockerpros\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\"},\"headline\":\"How do I use Docker with GitLab CI\/CD?\",\"datePublished\":\"2024-07-21T11:43:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/\"},\"wordCount\":1066,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dockerpros.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg\",\"articleSection\":[\"Integrations and Use Cases\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/\",\"url\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/\",\"name\":\"How do I use Docker with GitLab CI\/CD? - Dockerpros\",\"isPartOf\":{\"@id\":\"https:\/\/dockerpros.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg\",\"datePublished\":\"2024-07-21T11:43:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg\",\"width\":800,\"height\":600,\"caption\":\"how-do-i-use-docker-with-gitlab-ci-cd-2\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dockerpros.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How do I use Docker with GitLab CI\/CD?\"}]},{\"@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\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dockerpros.com\/#organization\",\"name\":\"Dockerpros\",\"url\":\"https:\/\/dockerpros.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@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\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4\",\"name\":\"dockerpros\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/dockerpros.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1783601465\",\"contentUrl\":\"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1783601465\",\"caption\":\"dockerpros\"},\"sameAs\":[\"https:\/\/dockerpros.com\/\"],\"url\":\"https:\/\/dockerpros.com\/es\/author\/dockerpros\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u00bfC\u00f3mo uso Docker con GitLab CI\/CD?\n\nGitLab es una plataforma de DevOps que proporciona un ciclo de vida completo para el desarrollo de software. GitLab CI\/CD es una herramienta integrada en GitLab que permite automatizar el proceso de construcci\u00f3n, prueba y despliegue de aplicaciones. Docker es una plataforma de contenedores que permite empaquetar aplicaciones y sus dependencias en contenedores ligeros y port\u00e1tiles.\n\nPara usar Docker con GitLab CI\/CD, necesitas configurar un archivo .gitlab-ci.yml en tu repositorio de GitLab. Este archivo define las etapas y trabajos que se ejecutar\u00e1n en el pipeline de CI\/CD. Aqu\u00ed tienes un ejemplo b\u00e1sico de c\u00f3mo configurar Docker en GitLab CI\/CD:\n\n1. Instala Docker en el runner de GitLab CI\/CD. Puedes hacerlo manualmente o utilizando una imagen de Docker que ya incluya Docker.\n\n2. Configura el archivo .gitlab-ci.yml para utilizar Docker. Aqu\u00ed tienes un ejemplo:\n\n```yaml\nstages:\n  - build\n  - test\n  - deploy\n\nbuild:\n  stage: build\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker build -t my-app .\n    - docker push my-app\n\ntest:\n  stage: test\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker run my-app npm test\n\ndeploy:\n  stage: deploy\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker run my-app npm start\n```\n\nEn este ejemplo, se definen tres etapas: build, test y deploy. En la etapa de build, se construye la imagen de Docker utilizando el Dockerfile del repositorio. En la etapa de test, se ejecutan las pruebas utilizando la imagen de Docker construida. En la etapa de deploy, se despliega la aplicaci\u00f3n utilizando la imagen de Docker.\n\n3. Configura las variables de entorno necesarias en GitLab CI\/CD. Por ejemplo, si necesitas autenticarte con un registro de Docker privado, puedes configurar las variables de entorno para almacenar las credenciales.\n\n4. Ejecuta el pipeline de CI\/CD en GitLab. GitLab ejecutar\u00e1 autom\u00e1ticamente las etapas y trabajos definidos en el archivo .gitlab-ci.yml.\n\nRecuerda que este es solo un ejemplo b\u00e1sico y que puedes personalizar el archivo .gitlab-ci.yml seg\u00fan las necesidades de tu proyecto. Adem\u00e1s, aseg\u00farate de tener los permisos adecuados para utilizar Docker en el runner de GitLab CI\/CD.\n\nEspero que esta informaci\u00f3n te sea \u00fatil para utilizar Docker con GitLab CI\/CD. Si tienes alguna pregunta adicional, no dudes en hacerla.","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\/es\/integraciones-y-casos-de-uso\/how-do-i-use-docker-with-gitlab-ci-cd\/","og_locale":"es_ES","og_type":"article","og_title":"How do I use Docker with GitLab CI\/CD? - Dockerpros","og_description":"To use Docker with GitLab CI\/CD, define a Docker image in your `.gitlab-ci.yml` file. This enables containerized builds and tests, ensuring consistency across environments.","og_url":"https:\/\/dockerpros.com\/es\/integraciones-y-casos-de-uso\/how-do-i-use-docker-with-gitlab-ci-cd\/","og_site_name":"Dockerpros","article_published_time":"2024-07-21T11:43:49+00:00","og_image":[{"width":800,"height":600,"url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg","type":"image\/jpeg"}],"author":"dockerpros","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"dockerpros","Tiempo de lectura":"6 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#article","isPartOf":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/"},"author":{"name":"dockerpros","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4"},"headline":"How do I use Docker with GitLab CI\/CD?","datePublished":"2024-07-21T11:43:49+00:00","mainEntityOfPage":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/"},"wordCount":1066,"commentCount":0,"publisher":{"@id":"https:\/\/dockerpros.com\/#organization"},"image":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg","articleSection":["Integrations and Use Cases"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/","url":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/","name":"\u00bfC\u00f3mo uso Docker con GitLab CI\/CD?\n\nGitLab es una plataforma de DevOps que proporciona un ciclo de vida completo para el desarrollo de software. GitLab CI\/CD es una herramienta integrada en GitLab que permite automatizar el proceso de construcci\u00f3n, prueba y despliegue de aplicaciones. Docker es una plataforma de contenedores que permite empaquetar aplicaciones y sus dependencias en contenedores ligeros y port\u00e1tiles.\n\nPara usar Docker con GitLab CI\/CD, necesitas configurar un archivo .gitlab-ci.yml en tu repositorio de GitLab. Este archivo define las etapas y trabajos que se ejecutar\u00e1n en el pipeline de CI\/CD. Aqu\u00ed tienes un ejemplo b\u00e1sico de c\u00f3mo configurar Docker en GitLab CI\/CD:\n\n1. Instala Docker en el runner de GitLab CI\/CD. Puedes hacerlo manualmente o utilizando una imagen de Docker que ya incluya Docker.\n\n2. Configura el archivo .gitlab-ci.yml para utilizar Docker. Aqu\u00ed tienes un ejemplo:\n\n```yaml\nstages:\n  - build\n  - test\n  - deploy\n\nbuild:\n  stage: build\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker build -t my-app .\n    - docker push my-app\n\ntest:\n  stage: test\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker run my-app npm test\n\ndeploy:\n  stage: deploy\n  image: docker:latest\n  services:\n    - docker:dind\n  script:\n    - docker run my-app npm start\n```\n\nEn este ejemplo, se definen tres etapas: build, test y deploy. En la etapa de build, se construye la imagen de Docker utilizando el Dockerfile del repositorio. En la etapa de test, se ejecutan las pruebas utilizando la imagen de Docker construida. En la etapa de deploy, se despliega la aplicaci\u00f3n utilizando la imagen de Docker.\n\n3. Configura las variables de entorno necesarias en GitLab CI\/CD. Por ejemplo, si necesitas autenticarte con un registro de Docker privado, puedes configurar las variables de entorno para almacenar las credenciales.\n\n4. Ejecuta el pipeline de CI\/CD en GitLab. GitLab ejecutar\u00e1 autom\u00e1ticamente las etapas y trabajos definidos en el archivo .gitlab-ci.yml.\n\nRecuerda que este es solo un ejemplo b\u00e1sico y que puedes personalizar el archivo .gitlab-ci.yml seg\u00fan las necesidades de tu proyecto. Adem\u00e1s, aseg\u00farate de tener los permisos adecuados para utilizar Docker en el runner de GitLab CI\/CD.\n\nEspero que esta informaci\u00f3n te sea \u00fatil para utilizar Docker con GitLab CI\/CD. Si tienes alguna pregunta adicional, no dudes en hacerla.","isPartOf":{"@id":"https:\/\/dockerpros.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage"},"image":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage"},"thumbnailUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg","datePublished":"2024-07-21T11:43:49+00:00","breadcrumb":{"@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#primaryimage","url":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg","contentUrl":"https:\/\/dockerpros.com\/wp-content\/uploads\/2024\/07\/how-do-i-use-docker-with-gitlab-ci-cd_231.jpg","width":800,"height":600,"caption":"how-do-i-use-docker-with-gitlab-ci-cd-2"},{"@type":"BreadcrumbList","@id":"https:\/\/dockerpros.com\/integrations-and-use-cases\/how-do-i-use-docker-with-gitlab-ci-cd\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dockerpros.com\/"},{"@type":"ListItem","position":2,"name":"How do I use Docker with GitLab CI\/CD?"}]},{"@type":"WebSite","@id":"https:\/\/dockerpros.com\/#website","url":"https:\/\/dockerpros.com\/","name":"Profesionales de Docker","description":"DockerPros \u2013 Tu centro definitivo de recursos 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":"es"},{"@type":"Organization","@id":"https:\/\/dockerpros.com\/#organization","name":"Profesionales de Docker","url":"https:\/\/dockerpros.com\/","logo":{"@type":"ImageObject","inLanguage":"es","@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\/"}},{"@type":"Person","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/a9b4c3d7f7a8e2b072e77d47b382a3a4","name":"profesionales de Docker","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/dockerpros.com\/#\/schema\/person\/image\/","url":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1783601465","contentUrl":"https:\/\/dockerpros.com\/wp-content\/litespeed\/avatar\/d13b9d4f101de1a7535b404e0c59affd.jpg?ver=1783601465","caption":"dockerpros"},"sameAs":["https:\/\/dockerpros.com\/"],"url":"https:\/\/dockerpros.com\/es\/author\/dockerpros\/"}]}},"_links":{"self":[{"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/comments?post=231"}],"version-history":[{"count":0,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/posts\/231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/media\/274"}],"wp:attachment":[{"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/media?parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/categories?post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dockerpros.com\/es\/wp-json\/wp\/v2\/tags?post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}