1

I'm trying to create a docker-compose with two dockerfiles, one of which uses two volumes. While one of the volumes, a named volume, does mount, the second, a local folder, does not.

version: '3.6'

volumes:
  logs:
    driver: local

services:
  proxy:
    build:
      context: .
      dockerfile: Dockerfile-nginx
    ports:
      - 80:80
    volumes:
      - ./site.api:/var/www/api
      - logs:/var/logs
  api:
    build:
      context: site.api/.

The named logs mount seems to show up fine (thought admittedly, I haven't tried putting data into it on the container yet, so not sure), but my local folder site.api, doesn't mount. If it matters, it's a Windows host and an Alpine container. I had a similar problem mounting a file directly, which I saw in an online guide, but assumed didn't work due to a difference in compose version (I tried mounting ./nginx.conf:/etc/nginx/conf.d/site.conf, which failed saying nginx: [crit] pread() "/etc/nginx/conf.d/site.conf" failed (21: Is a directory)).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.