I have the following directory:
.
└── wordpress
└── important-file.txt
1 directory, 1 files
My problem is that when I run the command below on my local WSL / Ubuntu
:
$ docker run -it --rm -v "$(pwd)"/wordpress:/var/www/html php:7.3-fpm-alpine /bin/sh
I was expecting to find file: important-file.txt
inside directory: /var/www/html
, but the directory was empty.
I tried this on two different local computers and the result was the same. So, if you try it, probably you will get the same result.
In the other hand , if I run the same command on a Digital Ocean
droplet the file is there.
Local WSL / Ubuntu system:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Digital Ocean droplet
# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
The file sharing of my Docker Desktop looks like:
Any idea on why I don't get that file on my local WSL / Ubuntu
system?
I found the solution here:
https://github.com/docker/for-win/issues/3385#issuecomment-533279510
Specifically what I did was:
docker-users
full control over the directory I want to mount:> icacls wordpress /q /c /t /grant docker-users:F
LxssManager
:WSL / Ubuntu
.That did the trick.
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.