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

186
Visualizações
Update shared volume from data container

Hi guys i'm in this situation, i'd like to deploy the changes in my source code by rebuilding the data container which contains a COPY command for transfer the source in the volume. However when i rebuild the data image and re-run docker-compose i stuck with the old code and the only way to update everything is to remove the webroot volume and recreate it.

Where is the mistake??

server:
  build: ./docker/apache
  image: server:1.3.16
  restart: always
  links:
    - fpm
  ports:
    - 80:80 # HTTP
    - 443:443 # HTTPS
  volumes:
    - webroot:/var/www/html:ro

fpm:
  build: ./docker/php
  image: fpm:1.0
  restart: always
  links:
    - database
  volumes:
    - webroot:/var/www/html

data:
  build:
   context: .
   dockerfile: dataDockerFile
  image: smanapp/data:1.0.0
  volumes:
    - webroot:/var/www/html

volumes:
  webroot:
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The named volume webroot is meant to persist data across container restart/rebuilds. The only time the data in the volume is updated from an image is when the volume is created, and the contents of the directory in the image are copied in.

It looks like you mean to use volumes_from which is how you get container to mount volumes defined on data. This is the original "data container" method of sharing data that volumes were designed to replace.

version: "2.1"

services:

  server:
    image: busybox
    volumes_from:
      - data
    command: ls -l /var/www/html

  fpm:
    image: busybox
    volumes_from:
      - data
    command: ls -l /var/www/html

  data:
    build: .
    image: dply/data
    volumes:
      - /var/www/html

Note that this has been replaced in version 3 of the compose file so you may need to stick with recreating the volume if you want to use newer features.

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