[GH-ISSUE #437] docker-compose running as root #293

Closed
opened 2026-03-01 14:42:10 +03:00 by kerem · 7 comments
Owner

Originally created by @jkonrath on GitHub (Aug 11, 2020).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/437

I'm trying out docker-compose and it's running as root, which gives me an error.

I.e.

$ echo "https://example.com" | docker-compose exec -T archivebox archivebox add
[i] [2020-08-11 20:00:18] ArchiveBox v0.4.11: archivebox add < /dev/stdin
    > /data

[!] ArchiveBox should never be run as root!
    For more information, see the security overview documentation:
        https://github.com/pirate/ArchiveBox/wiki/Security-Overview#do-not-run-as-root

Adding ALLOW_ROOT=True to my docker-compose.yml didn't do anything.

Also, a few nitpicky doc things on https://github.com/pirate/ArchiveBox/wiki/Docker:

  • it still says exec -T archivebox /bin/archive - should that last bit be archivebox add ?
  • It says http://127.0.0.1:8080 - should be 8000
Originally created by @jkonrath on GitHub (Aug 11, 2020). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/437 I'm trying out docker-compose and it's running as root, which gives me an error. I.e. ``` $ echo "https://example.com" | docker-compose exec -T archivebox archivebox add [i] [2020-08-11 20:00:18] ArchiveBox v0.4.11: archivebox add < /dev/stdin > /data [!] ArchiveBox should never be run as root! For more information, see the security overview documentation: https://github.com/pirate/ArchiveBox/wiki/Security-Overview#do-not-run-as-root ``` Adding `ALLOW_ROOT=True` to my `docker-compose.yml` didn't do anything. Also, a few nitpicky doc things on https://github.com/pirate/ArchiveBox/wiki/Docker: * it still says `exec -T archivebox /bin/archive` - should that last bit be `archivebox add` ? * It says `http://127.0.0.1:8080` - should be `8000`
kerem closed this issue 2026-03-01 14:42:10 +03:00
Author
Owner

@coisnepe commented on GitHub (Aug 12, 2020):

Running into this issue as well. Did you make any progress?

<!-- gh-comment-id:672776871 --> @coisnepe commented on GitHub (Aug 12, 2020): Running into this issue as well. Did you make any progress?
Author
Owner

@jkonrath commented on GitHub (Aug 12, 2020):

(Edit: this doesn't work. See my later comment.)

Haven't had time to try this, but according to https://dev.to/acro5piano/specifying-user-and-group-in-docker-i2e this might be a workaround:

  1. Add this to docker-compose.yml: user: "${UID}:${GID}"
  2. Start like this:
export UID=${UID}
export GID=${GID}
docker-compose up
<!-- gh-comment-id:672874720 --> @jkonrath commented on GitHub (Aug 12, 2020): (Edit: this doesn't work. See my later comment.) Haven't had time to try this, but according to https://dev.to/acro5piano/specifying-user-and-group-in-docker-i2e this might be a workaround: 1. Add this to `docker-compose.yml`: `user: "${UID}:${GID}"` 2. Start like this: ``` export UID=${UID} export GID=${GID} docker-compose up ```
Author
Owner

@cdvv7788 commented on GitHub (Aug 12, 2020):

What os are you using? It is happening to me on macos...just want to confirm it happens in linux too.

<!-- gh-comment-id:672876770 --> @cdvv7788 commented on GitHub (Aug 12, 2020): What os are you using? It is happening to me on macos...just want to confirm it happens in linux too.
Author
Owner

@jkonrath commented on GitHub (Aug 12, 2020):

I'm also macos. (10.15.4)

<!-- gh-comment-id:672885785 --> @jkonrath commented on GitHub (Aug 12, 2020): I'm also macos. (10.15.4)
Author
Owner

@cdvv7788 commented on GitHub (Aug 12, 2020):

Try running echo "https://example.com" | docker-compose run -T archivebox add
Also, check your docker-compose.yml file, and make sure you are using a locally built image or make sure you are actually pulling the latest and not using a local version (run docker-compose pull just in case).
Run:
docker build -t archivebox .
Change (docker-compose.yml):
image: archivebox
And then run:
echo "https://example.com" | docker-compose run -T archivebox add

The run command uses the docker-entrypoint, which takes care of adjusting the permissions for the specific user to run as. The docs definitely need some love.

<!-- gh-comment-id:672910537 --> @cdvv7788 commented on GitHub (Aug 12, 2020): Try running `echo "https://example.com" | docker-compose run -T archivebox add` Also, check your `docker-compose.yml` file, and make sure you are using a locally built image or make sure you are actually pulling the `latest` and not using a local version (run `docker-compose pull` just in case). Run: `docker build -t archivebox .` Change (docker-compose.yml): `image: archivebox` And then run: `echo "https://example.com" | docker-compose run -T archivebox add` The `run` command uses the `docker-entrypoint`, which takes care of adjusting the permissions for the specific user to run as. The docs definitely need some love.
Author
Owner

@jkonrath commented on GitHub (Aug 12, 2020):

That works!
What I ended up doing was changing the docker-compose.yml as you said for a local build, then built locally and it was fine. No need for setting the user. (I actually tried setting the user and that fails.)

(One minor problem: https://example.com doesn't actually exist. :) http works. That tripped me up for a minute...)

I can help with docs when I get some time, maybe this weekend. I'll take a pass and send a pull request when I get a chance.

<!-- gh-comment-id:673033722 --> @jkonrath commented on GitHub (Aug 12, 2020): That works! What I ended up doing was changing the docker-compose.yml as you said for a local build, then built locally and it was fine. No need for setting the user. (I actually tried setting the user and that fails.) (One minor problem: https://example.com doesn't actually exist. :) http works. That tripped me up for a minute...) I can help with docs when I get some time, maybe this weekend. I'll take a pass and send a pull request when I get a chance.
Author
Owner

@cdvv7788 commented on GitHub (Aug 12, 2020):

Weird...https works for me. That is a different issue tho. Glad it worked!

<!-- gh-comment-id:673047777 --> @cdvv7788 commented on GitHub (Aug 12, 2020): Weird...`https` works for me. That is a different issue tho. Glad it worked!
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#293
No description provided.