我有一个项目apkmirror-scraper-compose
,其中包含以下(简化)结构:
.
├── docker-compose.yml
└── tor
└── Dockerfile
docker-compose.yml
是
version: '3'
services:
tor:
build:
context: ./tor
args:
password: ""
ports:
- "9050:9050"
- "9051:9051"
Dockerfile
目录中的tor
是:
FROM alpine:latest
EXPOSE 9050 9051
ARG password
RUN apk --update add tor
RUN echo "ControlPort 9051" >> /etc/tor/torrc
RUN echo "HashedControlPassword $(tor --quiet --hash-password $password)" >> /etc/tor/torrc
CMD ["tor"]
我正在尝试将参数password
作为值""
(一个emtpy字符串)传递给Dockerfile
,以便它可以使用Tor对其进行哈希并添加配置文件的HashedControlPassword
行(参见https://www.torproject.org/docs/tor-manual.html.en)。
但是,如果我docker-compose build
后跟docker-compose up
,则日志包含以下内容:
Creating network "apkmirrorscrapercompose_default" with the default driver
Starting apkmirrorscrapercompose_tor_1
Attaching to apkmirrorscrapercompose_tor_1
tor_1 | May 02 08:03:59.344 [notice] Tor v0.2.8.12 running on Linux with Libevent 2.0.22-stable, OpenSSL LibreSSL 2.4.4 and Zlib 1.2.8.
tor_1 | May 02 08:03:59.345 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
tor_1 | May 02 08:03:59.345 [notice] Read configuration file "/etc/tor/torrc".
tor_1 | May 02 08:03:59.349 [warn] Linelist option 'HashedControlPassword' has no value. Skipping.
tor_1 | May 02 08:03:59.349 [warn] ControlPort is open, but no authentication method has been configured. This means that any program on your computer can reconfigure your Tor. That's bad! You should upgrade your Tor controller as soon as possible.
换句话说,password
参数没有得到“拾取”:Tor说它“没有价值”。但是,与https://docs.docker.com/compose/compose-file/#args上的示例相比,我看不出docker-compose.yml
或Dockerfile
有什么问题。
有人能发现问题所在吗?
答案 0 :(得分:0)
我认为问题在于password
是一个空字符串。如果我将其替换为"foo"
,则docker-compose up
似乎按预期工作。