Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
How do I mount a volume from one container into another one in Compose v3?

I need to build an stack with PHP-FPM and NodeJS. I don't want to mix both in the same container so I choose Docker Compose. This is how my docker-compose.yml looks like:

version: '3'
services:
    webserver:
        build: https://github.com/reypm/php-fpm
        args:
          INSTALL_COMPOSER: true
        dns:
            - 8.8.8.8
            - 8.8.4.4
        volumes:
          - ./laravel_node:/var/www/html
    nodejs:
        image: node:latest

In Docker Compose v3 volumes_from disappear and the docs here for volumes isn't so clear to me.

How do I mount the VOLUME /var/www/html on the NodeJS container so I run a command in NodeJS container and the result is present on PHP-FPM container?

I haven seen some examples 1, 2 but this isn't used or at least I couldn't find how to achieve this.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

use a named volume.

all you need to do is drop the ./ from the left side of your volume command

volumes:
  - laravel_node:/var/www/html

and the same goes into the node image

volumes:
  - laravel_node:/wherever/youwant/this/

by exclusing the path information from the left hand side of the volume, docker will create a named volume called "laravel_node". you can mount this volume into multiple containers, re-use that named volume across container instances, etc.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda