1 year ago

#366374

test-img

Timo Huovinen

How do I bind a volume in docker-compose to a host directory?

I have tried this but it doesn't seem to sync files when I change them inside the volume.

version: "3.7"
services:
  web:
    image: someimage
    volumes:
      - code:/code

volumes:
  code:
    driver: local
    driver_opts:
      o: bind
      type: none
      device: /Users/me/work/web

I don't want to do

services:
  web:
    image: someimage
    volumes:
      - /Users/me/work/web:/code

What am I doing wrong?

I am using mac, windows and linux. But currently testing on a mac 12.3.1

docker

docker-compose

volume

0 Answers

Your Answer

Accepted video resources