简体   繁体   中英

docker-compose / wordpress permissions error for volume mount

my docker-compose.yml

wordpress:
  image: wordpress
  links:
    - wordpress_db:mysql
  ports:
    - 8080:80
  volumes:
    - /tmp/html/:/var/www/html
wordpress_db:
  image: mysql:5.6.29
  environment:
    MYSQL_ROOT_PASSWORD: password
phpmyadmin:
  image: corbinu/docker-phpmyadmin
  links:
    - wordpress_db:mysql
  ports:
    - 8181:80
  environment:
    MYSQL_USERNAME: root
    MYSQL_ROOT_PASSWORD: password

when I do

sudo /usr/local/bin/docker-compose up

I'm getting a lot of these

wordpress_1     | tar: ./wp-content/plugins/akismet/views/stats.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/wrapper.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/.htaccess: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/class.akismet-widget.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/class.akismet-admin.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/class.akismet.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/readme.txt: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/index.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc: Cannot mkdir: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc/img: Cannot mkdir: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc/img/logo-full-2x.png: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc/form.js: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc/akismet.css: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/_inc/akismet.js: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/akismet.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/plugins/akismet/LICENSE.txt: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-content: Cannot mkdir: Permission denied
wordpress_1     | tar: ./wp-content/index.php: Cannot open: No such file or directory
wordpress_1     | tar: ./wp-trackback.php: Cannot open: Permission denied
wordpress_1     | tar: ./wp-links-opml.php: Cannot open: Permission denied
wordpress_1     | tar: ./wp-cron.php: Cannot open: Permission denied
wordpress_1     | tar: ./wp-signup.php: Cannot open: Permission denied
wordpress_1     | tar: .: Cannot utime: Permission denied
wordpress_1     | tar: .: Cannot change ownership to uid 33, gid 33: Permission denied
wordpress_1     | tar: .: Cannot change mode to rwxr-xr-x: Permission denied
wordpress_1     | tar: Exiting with failure status due to previous errors

any ideas?

I set 777 to /tmp/html

Regarding the permission denied part, this could be linked to:

  • the host (on Windows or ac, only C:\\Users or /Users is mounted by the Linux VirtualHost)
    That would make /tmp empty, resulting in an empty /var/www/html .
  • the Linux sec policy (see docker-library/wordpress issue 132 ) if you are directly on a Linux host.

The problem is that setenforce 0 works differently on Fedora and CentOS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM