You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docker-compose up should be able to create folders in the volumes it creates when ran in WSL2 environment regardless of what the parent folders name is.
Actual behavior
Assuming the folder has the following docker-compose.yml file:
docker-compose up produces the error below only on WSL2 and if the parent folder's name matches the following regex [a-z][0-9]{2}-psql-docker. If you rename the parent folder to say test2-psql-docker, docker compose will run without issue.
This is the error I get if parent folder is named j12-psql-docker:
~/j12-psql-docker
❯ docker-compose up
Recreating 85d224709979_j12-psql-docker_db-test_1 ... error
ERROR: for 85d224709979_j12-psql-docker_db-test_1 Cannot create container for service db-test: mkdir j12-psql-docker_db-data-volume: permission denied
ERROR: for db-test Cannot create container for service db-test: mkdir j12-psql-docker_db-data-volume: permission denied
ERROR: Encountered errors while bringing up the project.
Output if parent folder name is test2-psql-docker (this is the expected result given the contents of docker-compose.yml and postgres image)
~/test2-psql-docker
❯ docker-compose up
Creating network "test2-psql-docker_default" with the default driver
Creating volume "test2-psql-docker_db-data-volume" with default driver
Creating test2-psql-docker_db-test_1 ... done
Attaching to test2-psql-docker_db-test_1
db-test_1 | Error: Database is uninitialized and superuser password is not specified.
db-test_1 | You must specify POSTGRES_PASSWORD to a non-empty value for the
db-test_1 | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
db-test_1 |
db-test_1 | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
db-test_1 | connections without a password. This is *not* recommended.
db-test_1 |
db-test_1 | See PostgreSQL documentation about "trust":
db-test_1 | https://www.postgresql.org/docs/current/auth-trust.html
test2-psql-docker_db-test_1 exited with code 1
If I rename the parent folder to p77-psql-docker:
~/p77-psql-docker
❯ docker-compose up
Creating network "p77-psql-docker_default" with the default driver
Creating volume "p77-psql-docker_db-data-volume" with default driver
Creating p77-psql-docker_db-test_1 ... error
ERROR: for p77-psql-docker_db-test_1 Cannot create container for service db-test: mkdir p77-psql-docker_db-data-volume: permission denied
ERROR: for db-test Cannot create container for service db-test: mkdir p77-psql-docker_db-data-volume: permission denied
ERROR: Encountered errors while bringing up the project.
Information
Windows Version: Windows 10 Pro OS build: 19041.172 Version: 2004
Docker Desktop Version: 2.2.3.0 (43965)
Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No
WLS2: ubuntu 18.04
Steps to reproduce the behavior
Here is the gist I sent to a friend that was able to reproduce the error. He is also running the same version of docker-desktop. Below are hopefully easier steps to follow and a smaller docker-compose.yml file.
I also ran Clean / Purge data (checked off every option) and also ran Reset to factory defaults before doing the following steps.
Make sure Docker Desktop has WSL2 integration turned on
Start up WSL2 ubuntu 18.04 (no idea if this is specific to this distro, I don't have any others to test on)
In your user home directory (not on a windows mounted drive. I haven't tested if it also breaks there or not) create the following directory j12-psql-docker.
Create the following file files inside of that directory (This is different from the original gist. No .env file and a smaller docker-compose.yml file.
run docker-compose up if you don't have the postgres:apline image it'll download it first then fail with the following error:
~/j12-psql-docker
❯ docker-compose up
Creating network "j12-psql-docker_default" with the default driver
Creating volume "j12-psql-docker_db-data-volume" with default driver
Pulling db-test (postgres:alpine)...
alpine: Pulling from library/postgres
aad63a933944: Pull complete
a5b4c973b808: Pull complete
074a034a3a7a: Pull complete
48e4532f784a: Pull complete
4e7e92e65f6a: Pull complete
d5f366a1c147: Pull complete
b33682350b13: Pull complete
0204b658ab83: Pull complete
Digest: sha256:c52d4eac43883c53113cee0ebd1ce0fe53ef0604708822901ecca6655968fa9a
Status: Downloaded newer image for postgres:alpine
Creating j12-psql-docker_db-test_1 ... error
ERROR: for j12-psql-docker_db-test_1 Cannot create container for service db-test: mkdir j12-psql-docker_db-data-volume: permission denied
ERROR: for db-test Cannot create container for service db-test: mkdir j12-psql-docker_db-data-volume: permission denied
ERROR: Encountered errors while bringing up the project.
If you rename the folder from j12-psql-docker to something like test2-psql-docker and run docker-compose up again it'll work. It appears to only fail when the parent folder's name matches [a-z][0-9]{2}-psql-docker
If you do the same but outside of WSL2 (on the same machine) you won't get the error. I also tested this on my linux laptop and was not able to reproduce the issue.
Powershell, same folder name and docker-compose.yml file:
PS D:\docker\j12-psql-docker> ls
Directory: D:\docker\j12-psql-docker
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/6/2020 2:01 PM 153 docker-compose.yml
PS D:\docker\j12-psql-docker> docker-compose up
Creating j12-psql-docker_db-test_1 ... done
Attaching to j12-psql-docker_db-test_1
db-test_1 | Error: Database is uninitialized and superuser password is not specified.
db-test_1 | You must specify POSTGRES_PASSWORD to a non-empty value for the
db-test_1 | superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".
db-test_1 |
db-test_1 | You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
db-test_1 | connections without a password. This is *not* recommended.
db-test_1 |
db-test_1 | See PostgreSQL documentation about "trust":
db-test_1 | https://www.postgresql.org/docs/current/auth-trust.html
PS D:\docker\j12-psql-docker>
Expected behavior
docker-compose up
should be able to create folders in the volumes it creates when ran in WSL2 environment regardless of what the parent folders name is.Actual behavior
Assuming the folder has the following
docker-compose.yml
file:docker-compose up
produces the error below only on WSL2 and if the parent folder's name matches the following regex[a-z][0-9]{2}-psql-docker
. If you rename the parent folder to saytest2-psql-docker
, docker compose will run without issue.This is the error I get if parent folder is named
j12-psql-docker
:Output if parent folder name is
test2-psql-docker
(this is the expected result given the contents ofdocker-compose.yml
and postgres image)If I rename the parent folder to
p77-psql-docker
:Information
Steps to reproduce the behavior
Here is the gist I sent to a friend that was able to reproduce the error. He is also running the same version of docker-desktop. Below are hopefully easier steps to follow and a smaller
docker-compose.yml
file.I also ran
Clean / Purge data
(checked off every option) and also ranReset to factory defaults
before doing the following steps.j12-psql-docker
..env
file and a smallerdocker-compose.yml
file.File:
docker-compose.yml
docker-compose up
if you don't have thepostgres:apline
image it'll download it first then fail with the following error:j12-psql-docker
to something liketest2-psql-docker
and rundocker-compose up
again it'll work. It appears to only fail when the parent folder's name matches[a-z][0-9]{2}-psql-docker
Powershell, same folder name and
docker-compose.yml
file:Inspecting the volume:
The text was updated successfully, but these errors were encountered: