[GH-ISSUE #250] Docker: Permission denied: /data/sources #173

Closed
opened 2026-03-01 14:41:15 +03:00 by kerem · 2 comments
Owner

Originally created by @ghost on GitHub (Jul 1, 2019).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/250

I'm pretty much just doing this:

echo 'https://somesite.notld' | ssh (host) docker run -i -v /srv/webarchive:/data nikisweeting/archivebox env ONLY_NEW=True /bin/archive

Which gives me:

Traceback (most recent call last):
  File "/bin/archive", line 136, in <module>
    main(*sys.argv)
  File "/bin/archive", line 90, in main
    import_path = save_stdin_source(stdin_raw_text)
  File "/home/pptruser/app/archivebox/util.py", line 142, in save_stdin_source
    os.makedirs(SOURCES_DIR)
  File "/usr/lib/python3.5/os.py", line 241, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/data/sources'

Debian 9. If I give global write access to /srv/webarchive, it works. Not too sure how permission handling is supposed to work in Docker in this case. Could you point me in the right direction?

Thank you!

Originally created by @ghost on GitHub (Jul 1, 2019). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/250 I'm pretty much just doing this: ``` echo 'https://somesite.notld' | ssh (host) docker run -i -v /srv/webarchive:/data nikisweeting/archivebox env ONLY_NEW=True /bin/archive ``` Which gives me: ``` Traceback (most recent call last): File "/bin/archive", line 136, in <module> main(*sys.argv) File "/bin/archive", line 90, in main import_path = save_stdin_source(stdin_raw_text) File "/home/pptruser/app/archivebox/util.py", line 142, in save_stdin_source os.makedirs(SOURCES_DIR) File "/usr/lib/python3.5/os.py", line 241, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/data/sources' ``` Debian 9. If I give global write access to /srv/webarchive, it works. Not too sure how permission handling is supposed to work in Docker in this case. Could you point me in the right direction? Thank you!
kerem closed this issue 2026-03-01 14:41:16 +03:00
Author
Owner

@pirate commented on GitHub (Jul 5, 2019):

This is a common problem encountered with all docker setups and is unfortunately not solvable at the archivebox level. The reason is that the user inside the container needs to match the user outside the container in order for the permissions to work. One trick for bypassing the problem is to not create /src/webarchive yourself, but rather just make sure the parent directory exists, and let docker create the child directory with the correct permissions on first run.

You can also fix the permissions manually after it's already been created by chowning the folders on the host so that the container user has permission to write to them again. Here are some guides that go into more detail:
https://medium.com/@nielssj/docker-volumes-and-file-system-permissions-772c1aee23ca
https://denibertovic.com/posts/handling-permissions-with-docker-volumes/

<!-- gh-comment-id:508623346 --> @pirate commented on GitHub (Jul 5, 2019): This is a common problem encountered with all docker setups and is unfortunately not solvable at the archivebox level. The reason is that the user inside the container needs to match the user outside the container in order for the permissions to work. One trick for bypassing the problem is to not create `/src/webarchive` yourself, but rather just make sure the parent directory exists, and let docker create the child directory with the correct permissions on first run. You can also fix the permissions manually after it's already been created by chowning the folders on the host so that the container user has permission to write to them again. Here are some guides that go into more detail: https://medium.com/@nielssj/docker-volumes-and-file-system-permissions-772c1aee23ca https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
Author
Owner

@ghost commented on GitHub (Jul 5, 2019):

Thank you!

<!-- gh-comment-id:508627610 --> @ghost commented on GitHub (Jul 5, 2019): Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#173
No description provided.