Super User Asked by AndrewD on December 3, 2020
WordPress container fails to start when using docker-compose, where there are existing WordPress files, aborting with the following error:
sed: cannot rename ./sedtpghTB: Operation not permitted
Error only occurs when WordPress files are hosted on a VirtualBox (vboxsf) shared folder. Sharing the folder over SMB/CIFS avoids the error.
Setup:
/media/vmhost
Here is the output of docker-compose config:
networks: {}
services:
db:
environment:
MYSQL_DATABASE: my_db_name
MYSQL_PASSWORD: 'MY_ROOT_PASSWORD'
MYSQL_ROOT_PASSWORD: 'MY_ROOT_PASSWORD'
MYSQL_USER: root
image: mysql:5.7
ports:
- 3306:3306
restart: never
volumes:
- db_data:/var/lib/mysql:rw
wordpress:
depends_on:
- db
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_NAME: my_db_name
WORDPRESS_DB_PASSWORD: 'MY_PASSWORD'
WORDPRESS_DB_USER: root
image: wordpress:latest
ports:
- 80:80
restart: never
volumes:
- /media/vmhost/www/test:/var/www:rw
- /media/vmhost/www/test/public_html:/var/www/html:rw
version: '2.0'
volumes:
db_data: {}
wp_data: {}
When I attempt a sed on the vboxsf share, I get a similar error, but only when the source file is readonly.
echo 'hello' > hello.txt
chmod a-w hello.txt
sed -i 's/hello/goodbye/' hello.txt
error:
sed: cannot rename ./sed6x9apB: Operation not permitted
output of mount | grep www
www on /media/vmhost/www type vboxsf (rw,nodev,relatime)
When I use a CIFS share , mounted at /media/vmhost/www2 , everything works fine.
//my_laptop/www on /media/vmhost/www2 type cifs (rw,relatime,vers=1.0,sec=ntlm,cache=strict,username=vboxsf,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.1.5,file_mode=0777,dir_mode=0777,nounix,serverino,noperm,rsize=61440,wsize=65536,actimeo=1)
This appears to be a bug with VirtualBox, see Ticket #4890 .
Per frank's reply:
fixed for Linux hosts but not for Windows hosts. In contrast to Linux where a file can be removed if the directory is writable but the file itself is read-only, a read-only file cannot be removed on Windows
This impacts sed since sed makes a copy of the source file ( in this case wp-config-sample.php ) to a temporary file, and then attempts to make the replacements which windows won't support since the copy is also readonly.
For some reason, a proper share using CIFs is not impacted.
Workaround 1: Make the source file writeable and restart the container.
chmod a+w wp-config-sample.php
docker-compose up
Workaround 2: Use a CIFS share.
On your VirtualBox VM, add the following to /etc/fstab
//my_laptop/www /media/vmhost/www cifs username=WINDOWS_USER,password=WINDOWS_USER_PASSWORD,file_mode=0777,dir_mode=0777,iocharset=utf8,noperm,sec=ntlm 0 0
mount
mount -a
Answered by AndrewD on December 3, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP