docker compose ownership of named bind volume with specified path

43 Views Asked by At

I use a docker-compose file to create service with a named bind volume, and I precise its path :

docker-compose.yml :

services:
  wordpress:
    volumes:
      - wp_plugin:/path/inside/container

volumes:
  wp_plugins:
    driver: local
    driver_opts:
      type: none
      o: "bind"
      device: /path/on/local/machine

This works great, except for one thing : the owner of the volume on my local machine changes from <user>:<user> to something like systemd-network:65743 when I start the container with docker compose -f docker-compose.yml up -d

I can manually change the user and group owners back to the user by using sudo, but how can I prevent docker from doing this change of ownership ?

0

There are 0 best solutions below