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

181
Vistas
docker-compose volume not appearing in container

I'm trying to build a stack with one docker-compose that should contain another containers inside. This is to run a development environment with all my projects inside.

So the problem is the volume with application source isn't appearing on built image.

MacOS Sierra
Docker version 17.03.0-ce, build 60ccb22
Boot2Docker-cli version: v1.8.0

my directory tree

/dockers                 <======= one directory with all docker files for each project

  docker-compose.yml     <======= The main image

  /project1              <======= dockerfile for each project
    Dockerfile
  /project2
    Dockerfile
  /project3
    Dockerfile

/project1              <======= project1 source folder
  test.txt
/project2
/project3

my docker-compose.yml

project1:
  build: ./project1
  volumes:
    - ../project1/:/src

my dockerfile for project1

FROM python:2.7

RUN mkdir -p /src

WORKDIR /src
RUN echo "---------------------"
RUN ls -la
RUN echo "---------------------"

So I try to build the docker-compose file

$ sudo docker-compose build --no-cache

And then it shows an empty folder when I expect test.txt file

Building express
ERROR: Cannot locate specified Dockerfile: Dockerfile
➜  docker git:(master) ✗ sudo docker-compose build --no-cache
Building project1
Step 1/7 : FROM python:2.7
 ---> ca388cdb5ac1
Step 2/7 : RUN mkdir -p /src
 ---> Running in 393a462f7a44
 ---> 4fbeb32d88b3
Removing intermediate container 393a462f7a44
Step 3/7 : WORKDIR /src
 ---> 03ce193577ab
Removing intermediate container b1cd746b699a
Step 4/7 : RUN echo "--------------------------"
 ---> Running in 82df8a512c90
----------------------------
 ---> 6dea58ba5051
Removing intermediate container 82df8a512c90
Step 5/7 : RUN ls -la
 ---> Running in 905417d0cd19
total 8
drwxr-xr-x 2 root root 4096 Mar 23 17:12 .                    <====== EMPTY :(
drwxr-xr-x 1 root root 4096 Mar 23 17:12 ..                   <====== EMPTY :(
 ---> 53764caffb1a
Removing intermediate container 905417d0cd19
Step 6/7 : RUN echo "-----------------------------"
 ---> Running in 110e765d102a
----------------------------
 ---> b752230fd6dc
Removing intermediate container 110e765d102a
Step 7/7 : EXPOSE 3000
 ---> Running in 1cfe2e80d282
 ---> 5e3e740d5a9a
Removing intermediate container 1cfe2e80d282
Successfully built 5e3e740d5a9a
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Volumes are runtime configurations in Docker. Because they are configurable, if you were to reference volumes during the build phase you would essentially be creating a potentially uncheckable broken dependency.

I'm sure there is a more technical reason - but it really shouldn't be done. Move all that stuff to the runtime setup command and you should be OK.

about 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