Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
How to replace volumes_from in docker-composer v3

I want to know the equivalent of the configuration below to suit version 3 of docker-composer.yml! volumes_from is no longer valid so am I supposed to skip the data volume and replace it with top level volumes ?

version: '2'
services:

  php:
    build: ./docker-files/php-fpm/.
    volumes_from:
      - data
    working_dir: /code
    links:
      - mysql

  nginx:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    volumes_from:
      - data
    links:
      - php

  data:
    image: tianon/true
    volumes:
      - .:/code
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

By default named volumes allow you to share data between containers. But it is some troubles with storing data in the same place on the host machine after restarting containers. But we can use local-persist docker plugin for fix it.

For migration to version 3 you need

1) install local-persist docker plugin (if you want to store volumes data to the particular place on the host machine)

2) modify docker-compose.yml

version: '3'
services:

  php:
    build: ./docker-files/php-fpm/.
    volumes:
      - data:/code
    working_dir: /code
    links:
      - mysql

  nginx:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    volumes:
      - data:/code
    links:
      - php

  data:
    image: tianon/true
    volumes:
      - data:/code

# If you use local persist plugin
volumes:
  data:
    driver: local-persist
    driver_opts:
      mountpoint: /path/on/host/machine/

# Or If you dont want using local persist plugin
volumes:
  data:

Also you can store volumes data to the host machine with this volumes section:

volumes:
  data:
    external: true #< it means store my data to the host machine

But you can't specify path for this volume on host machine

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda