- Docker-Compose + Postgres: /docker-entrypoint-initdb.d/init.sql: Permission denied
- 5 Answers 5
- Почему получаю при работе с git на windows Permission denied (publickey)?
- git init failed with Permission denied #53
- Comments
- dipucian commented Aug 14, 2018
- dipucian commented Aug 14, 2018
- pavelxkrejci commented Aug 14, 2018
- pavelxkrejci commented Aug 14, 2018 •
- EKoetsjarjan commented Feb 4, 2019
- EKoetsjarjan commented Feb 4, 2019
- pavelxkrejci commented Feb 4, 2019
- holgerbrandl commented Jun 24, 2019
- snaphat commented Aug 9, 2019
- maiormarso commented Jan 7, 2020 •
- Nabeel70 commented May 5, 2020
- smares commented Oct 20, 2020 •
- peterbelm commented Jan 16, 2021
- Permission denied on Windows 10 when writing to host volume #497
- Comments
- bhabermaas commented Feb 13, 2017
- Expected behavior
- Actual behavior
- Information
- Steps to reproduce the behavior
- bhabermaas commented Feb 13, 2017
- rn commented Feb 13, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017 •
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- rn commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017
- bhabermaas commented Feb 14, 2017 •
- seydu commented Feb 23, 2017
- bhabermaas commented Feb 23, 2017
- seydu commented Feb 23, 2017
- xaljer commented Nov 2, 2017 •
Docker-Compose + Postgres: /docker-entrypoint-initdb.d/init.sql: Permission denied
I have the following docker compose file:
This is the init-db.sql:
When I run docker-compose up , I’m getting this error:
I already tried to:
- chmod 777 on the sql file
- chmod -x on the sql file
- Run docker and docker-compose using sudo
5 Answers 5
I found the easy way to solve this.
You should use «build» way to create postgres service
And DO NOT setting the volume for init.sql, it will cause the permission problem.
Create a Dockerfile for postgres like this
Then it should works out. Hope my answer would help you!
I had a similar problem when using the ADD command.
When using ADD (eg to download a file) the default chmod value is 711. When using the COPY command the chmod will match the hosts chmod of the file where you copy it from. The solution is to set the permission before copying, or change them in your Dockerfile after they’ve been copied.
It looks like there will finally be a «COPY —chmod 775» flag available in the upcoming docker 20 which will make this easier.
Почему получаю при работе с git на windows Permission denied (publickey)?
Всем привет.
Не могу работать с гитом по ssh, сгенерил ключ, добавил его на github, сделал ssh-add.
И всё равно получаю:
Получаю такое и при использовании CMD, PowerShell, Git Bash.
Гит установлен, система windows, последнее обновление x64, OpenSSH agent в службах запущен.
- Вопрос задан 20 мая 2020
- 5427 просмотров
> сгенерил ключ
чем, как?
> сделал ssh-add
какой командой? в какой оболочке?
> Получаю такое и при использовании CMD, PowerShell, Git Bash.
получаете в ответ на какую команду?
2) Git Bash: — пардон, не получается сделать ssh-add потому что пишет — , попытался сделать eval «ssh-agent» , получил на это:
Но после этого ssh-add всё равно не работает.
3) git clone / git push -u origin margin
/.ssh теперь есть закрытый ключ id_rsa и открытый ключ id_rsa.pub. проверьте, так ли это.
> добавил его на github
в гитхаб вы добавляли открытый ключ
git init failed with Permission denied #53
Comments
dipucian commented Aug 14, 2018
I can map a network drive ( Z: ) and have read/write access to it, but when I try git init , it failed with error like: Z:/deployScript/.git/: Permission denied
where should I look? for these kind of problem.
The text was updated successfully, but these errors were encountered:
dipucian commented Aug 14, 2018
I tried both \\sshfs\user@host and \\sshfs\windowsUser=user@host
pavelxkrejci commented Aug 14, 2018
|
pavelxkrejci commented Aug 14, 2018 •
The problem may be that windows git tries to set hidden attribute on «.git» folder which is not available on Linux/ssh. The error message would be than more likely result of git internal logic and not directly related to sshfs.
Edit: This is confirmed in Process Monitor all git filesystem operations result with success.
EKoetsjarjan commented Feb 4, 2019
Hi @pavelxkrejci do you have any suggesition for a workaround?
I have the same problem .
EKoetsjarjan commented Feb 4, 2019
I just maybe found one, I have logged in to the linux box and created a git repository using git init inside the shared folder .
then I opened the shared folder from windows and tried to commit/fetch changes, all worked well 🙂
pavelxkrejci commented Feb 4, 2019
Easiest might be just «git init» in a local folder and then move the «.git» folder to the intended ssh folder.
holgerbrandl commented Jun 24, 2019
This also is an issue when rendering reports with https://github.com/rstudio/rmarkdown which also created hidden directory (similar to the .git directory) and fails to run on directories mounted with sshfs-win
snaphat commented Aug 9, 2019
Same problem with hg, but commits don’t even work there.
maiormarso commented Jan 7, 2020 •
Win10, right click on the [Git Bash] icon and select ‘Run as Administrator’
Nabeel70 commented May 5, 2020
Here is a simplest solution!!
First show your hidden files of drives then open command-line By «Run as administrator»!!
smares commented Oct 20, 2020 •
I am using TortoiseHg and cannot do anything because of permission denied errors for the .hg directory.
Edit: Obviously referring to Mercurial and not Git.
peterbelm commented Jan 16, 2021
I’ve been tracking down this issue and it’s a mixture of problems across three applications:
- Git attempts to create the .git directory twice, the second time it calls wmkdir the call fails with permission denied — which Git reports and then exits. Attempting to create the directory twice isn’t great, but I believe the subsequent handling of the error is correct.
- According to this link a lot of SFTP servers (OpenSSH included) don’t support the extended range of codes that could indicate that the directory exists, so it returns code 4 ‘Failure’ — which isn’t particularly helpful.
- sshfs maps this status to the EPERM result code, hence why Git is getting permission denied. The correct result code for this situation should be EEXIST.
As you can see in the linked issue on sshfs I’ve submitted a patch that will check whether a directory is accessible if mkdir fails with EPERM, returning the correct EEXIST code if it is. With this patch I’ve been able to successfully clone a Git repo using sshfs-win.
Permission denied on Windows 10 when writing to host volume #497
Comments
bhabermaas commented Feb 13, 2017
Expected behavior
It should work. It used to before updating to docker 1.13.0
Actual behavior
Fails with permission denied.
Information
A diagnostic was uploaded with id: A793F06A-2BB2-4848-AECB-269265A747E3/2017-02-13_17-36-24
- Diagnostic ID from «Diagnose & Feedback» in the menu.
- a reproducible case if this is a bug, Dockerfiles FTW
- page URL if this is a docs issue or the name of a man page
- host distribution and version (Windows version, build number, etc)
Steps to reproduce the behavior
The text was updated successfully, but these errors were encountered:
bhabermaas commented Feb 13, 2017
I have allowed all permissions on the mounted volume. If I use the CLI to run the container and mount the volume I can write if I chmod 777.
Using the Remote API, the volume has a bind rw, but unable to write and get permission denied.
rn commented Feb 13, 2017
Thanks for the report. Could you provide a concrete example for us to better understand the issue?
thanks
bhabermaas commented Feb 14, 2017
Very simple. This was working and now it isn’t.
PS C:\Users\bihaber> docker run —rm -it -u fmwpltfm -v //d/dockerOutput:/output:rw fmwtest:latest bash
fmwpltfm@ef5fab65723e:/$ cd /output
fmwpltfm@ef5fab65723e:/output$ ls -al
total 4
drwxr-xr-x 2 root root 60 Feb 14 13:20 .
drwxr-xr-x 1 root root 4096 Feb 14 13:27 ..
-rw-r—r— 1 root root 0 Feb 14 13:20 test
fmwpltfm@ef5fab65723e:/output$ touch test
touch: cannot touch ‘test’: Permission denied
fmwpltfm@ef5fab65723e:/output$
rn commented Feb 14, 2017 •
When you say it used to work, which version did you use before? stable or beta channel?
thanks
bhabermaas commented Feb 14, 2017
No problem on 1.12 stable. I upgraded to 1.13.0 and it worked. then I got a notice to update. hasn’t worked since.
rn commented Feb 14, 2017
I can’t reproduce this. I tried your command line above, but it can’t find the fmwtest image so I use standard ubuntu and use two different users already configured.
Could you provided the output of id when inside your container as user fmwpltfm ?
We did not change anything with regards to the mounting between 1.13.0 stable and the latest stable. I tried the above on the latest Beta, but again we dod not change anything related to the shared volumes there either
bhabermaas commented Feb 14, 2017
Must be a Windows 10 update that is causing it.
rn commented Feb 14, 2017
I’m not sure. I’ve tried on build 10586.672 and 14393.693 (latest RS1 update) and latest insider fast ring build 15031.0 and all three work
bhabermaas commented Feb 14, 2017
Seems to be tired to what userid I specify for the container. I have added that user to windows and given it all access to the disk. But I still get permission denied. Is there anyway that I can turn off permission checking for a mount?
rn commented Feb 14, 2017
The UID mapping is done by the samba client/server and is not easily changeable.
What is the output of id when you are inside the container?
What is are the permissions on the /output directory in the container?
bhabermaas commented Feb 14, 2017
If I run without the mount, the permissions look correct —
PS C:\Users\bihaber> docker run —rm -it fmwtest:latest bash
root@d74e5994d6b7:/# ls -al /test_output
total 8
drwxrwxrwx 1 fmwpltfm root 4096 Aug 23 08:53 .
drwxr-xr-x 1 root root 4096 Feb 14 14:34 ..
root@d74e5994d6b7:/# exit
exit
If I run it with the mount then the permissions are lost —
PS C:\Users\bihaber> docker run —rm -it -u fmwpltfm -v //d/dockerOutput:/test_output:rw fmwtest:latest bash
fmwpltfm@a3463248866f:/$ ls -al /test_output
total 4
drwxr-xr-x 2 root root 40 Feb 14 14:10 .
drwxr-xr-x 1 root root 4096 Feb 14 14:34 ..
fmwpltfm@a3463248866f:/$
rn commented Feb 14, 2017
because in the first case you are loooking at a local directory in the container and in the second case you are looking at the drectory mounted from the host. These are different directories with different permission settings
bhabermaas commented Feb 14, 2017
So how do I get the permissions to agree? On windows the dockerOutput directory has full access for user fmwpltfm (windows user).
bhabermaas commented Feb 14, 2017
rn commented Feb 14, 2017
This has little to do with the permissions on the host (ie windows). When you share the drive in Docker for Windows you provide a username/password in the dialog box. This is passed to the Linux VM which uses these credentials to SMB mount the drive. Inside the VM the directories are mounted with the default user and permission (root and 0755).
I’m not entirely sure why this works for me, but not for you. Again, could you provide the output of id when in the container. Also, another difference may be, is windows user fmwpltfm a local admin or not?
bhabermaas commented Feb 14, 2017
Below is the same output but with the user id from container. I have tried putting the windows user in all different groups but with no affect.
ALL I WANT TO DO IS HAVE MY PROGRAM RUNNING IN THE CONTAINER BE ABLE TO WRITE ITS OUTPUT TO THE DIRECTORY ON WINDOWS.
PS C:\Users\bihaber> docker run —rm -it -u fmwpltfm -v //d/dockerOutput:/test_output:rw fmwtest:latest bash
fmwpltfm@2631ad002435:/$ id
uid=735019(fmwpltfm) gid=1000(fmwpltfm) groups=1000(fmwpltfm)
fmwpltfm@2631ad002435:/$ ls -al /test_output
total 4
drwxr-xr-x 2 root root 40 Feb 14 14:10 .
drwxr-xr-x 1 root root 4096 Feb 14 15:12 ..
fmwpltfm@2631ad002435:/$
rn commented Feb 14, 2017
I understand what you want to do. No need to use all capital letters. It’s rude
bhabermaas commented Feb 14, 2017
Sorry I apologize.
bhabermaas commented Feb 14, 2017 •
I uninstalled Docker 1.13.1 and reinstalled Docker 1.12.3 — problem solved.
The moral of the story is: Do not update to a newer Docker if the one you have works.
Obviously Docker 1.13 stable isn’t as stable as it should be.
seydu commented Feb 23, 2017
@bhabermaas How did you downgrade to 1.12?
I am trying to do so but I cannot find that version of docker for Windows.
bhabermaas commented Feb 23, 2017
Fortunately I had the earlier download so I could install it after uninstalling 1.13. You should ask the Docker people where you can get earlier releases.
seydu commented Feb 23, 2017
xaljer commented Nov 2, 2017 •
I use Docker for windows 17.10.0-ce-win36 (13788) on Windows 1709, and I enable Linux containers on Windows (tech preview). When I do touch a.txt on the mounted host volume, I got touch: setting times of ‘a.txt’: Permission denied , and the same operation on other path in container is OK.
I found this because I got some similar errors, like: rsync: mkstemp «/workspace/test-read-speed/subsystems/linux/configs/device-tree/.zynq-7000.dtsi.qRGtxg» failed: Permission denied (13) and rsync: failed to set permissions on «/workspace/test-read-speed/.»: Permission denied (13) .
I changed permission of that path on Windows for all users, but it does not work.