Docker-sync: troubles with permissions

Created on 12 Jul 2016  路  11Comments  路  Source: EugenMayer/docker-sync

Hello!
I'm using docker-sync for symfony app. I have problems with user that sync in the container.
in eugenmayer/rsync container user is www-data, in php-fpm container user is xfs with another g_id, so I'm in troubles with permissions.

docker-sync.yml

syncs:
  appcode-sync: 
      src: './../'
      dest: '/var/www'
      sync_host_ip: 'localhost'
      sync_host_port: 10872
      sync_user: 'www-data'
      sync_userid: '1000'
      sync_group: 'www-data'
      sync_groupid: '82'

docker-compose.yml

version: '2'
services:
    db:
        image: mysql:latest
        ports:
            - "3306:3306"
        environment:
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: lookaround
            MYSQL_USER: root
            MYSQL_PASSWORD: root
    php:
        build: ./../.docker/php-fpm
        expose:
            - "9000"
        volumes_from:
          - container:appcode-sync # will be mounted on /var/www
        #command: ['watch', '-n3', 'cat /var/www/web/app_dev.php']
        links:
            - db
            - redis
    nginx:
        build: ./../.docker/nginx
        ports:
            - "80:80"
        links:
            - php
        volumes_from:
            - php
        volumes:
            - ./../var/logs/nginx/:/var/log/nginx
    elk:
        image: willdurand/elk
        ports:
            - "81:80"
        volumes:
            - ../.docker/elk/logstash:/etc/logstash
            - ../.docker/elk/logstash/patterns:/opt/logstash/patterns
        volumes_from:
            - php
            - nginx
    redis:
        image: redis:latest
    phan:
        image: cloudflare/phan:latest
        volumes:
            - ./../:/mnt/src

volumes:
    appcode-sync:
        external: true
bug incomplete invalid

Most helpful comment

well if your fpm user is different, why do you use ww-data and the uid a used by default?

adjust those settings to match your destination container.

    sync_user: 'www-data'
      sync_userid: '1000'
      sync_group: 'www-data'
      sync_groupid: '82'

if your user on the fpm container is called xfs with the uid 5000 and the group is mygroup with gid 9000, do

      sync_user: 'xfs'
      sync_userid: '5000'
      sync_group: 'mygroup'
      sync_groupid: '9000'

All 11 comments

well if your fpm user is different, why do you use ww-data and the uid a used by default?

adjust those settings to match your destination container.

    sync_user: 'www-data'
      sync_userid: '1000'
      sync_group: 'www-data'
      sync_groupid: '82'

if your user on the fpm container is called xfs with the uid 5000 and the group is mygroup with gid 9000, do

      sync_user: 'xfs'
      sync_userid: '5000'
      sync_group: 'mygroup'
      sync_groupid: '9000'

sorry, I didn't get it.
normally in fpm container my user is www-data with id 1000.
this is screenshot of mounted volume in this container with docker-sync
screen shot 2016-07-15 at 1 28 14 am
And permissions denied

interesting, i see what you are running into. What uid does xfs has in the FPM container?
if you docker exec -i -t appcode-sync sh while the stack is up and the

do a

ls -la /var/www

how does this look like - who is the owner?

if I do ls -la via connecting to sh (I'm using sync_user: 'www-data' in docker-sync.yml)
screen shot 2016-07-15 at 1 40 43 am

that looks fine.. run cat /etc/passwd | grep www-data on the appsync container, what do you get?

Also, which uid does you xfs user has, please run cat /etc/passwd | grep xfs on the fpm container

# cat /etc/passwd | grep www-data
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
and
Vladislavs-MacBook-Pro:~ kopaygorodsky$ docker exec -it rsync_php_1 sh
/var/www $ cat /etc/passwd | grep xfs
xfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologin

well so we have an issue on the rsync container side, it does not set the UID right. Odd, i cannot reproduce this on my side right now. Please give me some time to jump on this, its midnight here, i tryt that tomorrow / weekend. Thanks for reporting back

I can add you to my repo temporary; there is an almost empty project so no problem with it.

Since this is the last blocker for 0.0.14 i am trying to wrap my head arround it

it might be already solved by the new rsync container from Duske.

@kopaygorodsky can you do docker-sync clean and docker pull eugenmayer/rsync and try if your issue still pops up?

After trying with https://github.com/EugenMayer/docker-sync-boilerplate/tree/master/advanced i cannot reproduce this right now. After starting the app cotinaer container

-rw-r--r--    1 1001     1002            37 Jul 13 18:29 index.html

Exactly how expected

and on the sync container i have

-rw-r--r--    1 www-data www-data        37 Jul 13 18:29 index.htm

I cannot reproduce what you have shown up, this might be rather and issue coming from bootstrapping you app-container?

Removing this as a blocker for 0.0.14 since it cannot be reproduced in normal state

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gagarine picture gagarine  路  6Comments

aandrushchenko picture aandrushchenko  路  5Comments

donnykurnia picture donnykurnia  路  8Comments

b1alpha picture b1alpha  路  7Comments

anlek picture anlek  路  7Comments