Docker Community Forums

Share and learn in the Docker community.

Docker-compose is creating an empty folder in the host


(Theenmanuel23) #1

docker-compose is creating an empty folder in the host.

I have a dist folder generated with webpack, I want to create volume in host with the dist folder of the container, the dist folder is working in the container but in host is empty.
I want to see the files of dist directory of the container in the static directory of the host.

version: '3.6'

services:
  api_services:
    build: ./api
    ports:
      - 8000:8000

  web_services:
    build:
      context: ./client
      args:
        NODE_ENV: production
        API_URL: http://localhost:8000
    ports:
     - 3000:3000
    volumes:
     - ./static:/dist
    depends_on:
      - api_services

before I was generating the dist folder with a RUN in the Dockerfile, I thought that was the problem, now I generate it in the host and I copy it in the container, but it still does not work.

The final result that I want to achieve is to be able to use that static folder created with the volume and use it for static with nginx

....
  nginx:
    image: nginx:latest
    ports:
      - "8080:8080"
    volumes:
      - ./static:/srv/www/static
      - ./nginx/web.conf:/etc/nginx/conf.d/default.conf
....