Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating directory on torrc.config override #2

Open
markheloking opened this issue Nov 5, 2019 · 2 comments
Open

Error creating directory on torrc.config override #2

markheloking opened this issue Nov 5, 2019 · 2 comments

Comments

@markheloking
Copy link

markheloking commented Nov 5, 2019

When I try to override the config file using a volume mount, I get an error running the container:

Nov 05 21:50:06.750 [notice] Tor 0.4.1.6 running on Linux with Libevent 2.1.10-stable, OpenSSL 1.1.1c, Zlib 1.2.11, Liblzma N/A, and Libzstd N/A.
Nov 05 21:50:06.750 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Nov 05 21:50:06.751 [notice] Read configuration file "/etc/tor/torrc.config".
Nov 05 21:50:06.755 [notice] Opening OR listener on 0.0.0.0:9001
Nov 05 21:50:06.755 [notice] Opened OR listener on 0.0.0.0:9001
Nov 05 21:50:06.755 [notice] Opening Directory listener on 0.0.0.0:9030
Nov 05 21:50:06.755 [notice] Opened Directory listener on 0.0.0.0:9030
Nov 05 21:50:06.755 [warn] Error creating directory /var/lib/tor/.tor: Permission denied
Nov 05 21:50:06.755 [warn] Failed to parse/validate config: Couldn't create private data directory "/var/lib/tor/.tor"
Nov 05 21:50:06.755 [err] Reading config failed--see warnings above.

docker-compose.yml:

version: "3.7"
services:
    torrelay:
        container_name: torrelay
        hostname: torrelay
        restart: always
        image: chris579/tor-alpine
        volumes:
          - /etc/localtime:/etc/localtime:ro
          - /data/tor/data:/var/lib/tor
          - /data/tor/config/torrc.config:/etc/tor/torrc.config
        ports:
          - 9001:9001
          - 9030:9030

Obviously it's some permission issue, but I can't seem to figure out what's wrong. I haven't volume mapped the whole /var/lib/tor directory, so I was assuming it shouldn't be an issue in that regard, but then I don't get this issue when I'm not overriding the config through a volume map.

Do I need to override the config some other way that I'm not seeing?

[EDIT]
Trying to pass the PUID and PGID didn't help either.

        environment:
          - PUID=${PUID}
          - PGID=${PGID}

The /data/tor folder and all contents are owned by the docker user.
Mapping the directory instead of the file doesn't work either:

          - /data/tor/config:/etc/tor
@ehnwebmaster
Copy link

The /data/tor folder and all contents are owned by the docker user.

The user must be tor user, not the docker user

chown -R tor /var/lib/tor

Enter the docker

docker exec -it torrelay /bin/ash

and inspect the owner:

ls -l /var/lib/tor

@klemmchr
Copy link
Owner

klemmchr commented Feb 6, 2022

Is this still an issue? I never experienced it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants