I'm using a very simple docker-compose file:
version: '2'
services:
db:
image: mysql:5.7 # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb
container_name: prestashop_db
ports:
- 3306:3306 # change ip if required
volumes:
# for init
- ./db-init:/docker-entrypoint-initdb.d # IMPORTANT ! comment after the first docker-compose up
- ./db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: prestashop
MYSQL_USER: docker
MYSQL_PASSWORD: docker
restart: unless-stopped
prestashop:
image: prestashop/prestashop:1.7-7.2-apache
container_name: prestashop_www
ports:
- 127.0.0.1:80:80 # change ip if required
volumes:
# sites directory: add the sources
- ./src:/var/www/html
environment:
DB_SERVER: "db:3306"
DB_USER: docker
DB_PASSWD: docker
depends_on:
- db
links:
- db:db
All the content generated in my src directory, which actually corresponds to prestashop code, has the www-data:www-data owner. This means I can't actually edit it. If I change permissions or create any files as the host user, I get permission errors in the service because my user is not mapped.
I'd like to ask docker to map my host user to the www-data user in the prestashop service and specify it in the docker-compose file. Is it possible? This is something I used to do with LXC containers and was very useful.
I'd like not to: * Run any scripts to change permissions or add my user to the www-data group in my host machine
Thanks for your help