Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Wordpress tar: <file> Cannot change ownership to uid 33, gid 33: Operation not permitted

I have created a docker-compose file for local development using Wordpress, and I've finally got NFS working (normal volume mount was too slow, because of Docker / Mac issues).

Except I'm running into a new issue, all files in the NFS share (which is the wp_content folder) give such error:

tar: ./wp-content/themes/twentynineteen/archive.php: 
Cannot change ownership to uid 33, gid 33: Operation not permitted

I've found this issue https://github.com/docker-library/wordpress/issues/137 in which they refer to https://github.com/docker-library/wordpress/pull/249, but I still can't get it working. Wondering if anyone can help me out, this is my docker-compose file:

version: '3.3'

services:
  wordpress:
    image: wordpress:latest
    ports:
      - "80:80"
    restart: always
    volumes:
      - nfsmount:/var/www/html/wp-content
      - ./.htaccess:/var/www/html/.htaccess:cached
      - ./wp-data/wp-config.php:/var/www/html/wp-config.php:cached
      - ./logs/debug.log:/var/www/html/wp-content/debug.log
    environment:
      APACHE_RUN_USER: www-data
      APACHE_RUN_GROUP: www-data

volumes:
  nfsmount:
    driver: local
    driver_opts:
      type: nfs
      o: addr=host.docker.internal,rw,nolock,hard,nointr,nfsvers=3
      device: ":/Users/myuser/Sites/dockertest/wp-data/wp-content" 
like image 541
Erik van de Ven Avatar asked Jan 25 '19 09:01

Erik van de Ven


1 Answers

The error is reported by tar command that try to change owner.

In order to avoid tar to set owner you can set variable TAR_OPTIONS to --no-same-owner
From tar manual:

--no-same-owner
Extract files as yourself (default for ordinary users).

You can add this in your docker-compose file with :

  TAR_OPTIONS: --no-same-owner
like image 105
mpromonet Avatar answered Sep 21 '22 22:09

mpromonet