Docker图像无声地无法启动
以下Docker映像成功构建但不会运行 - 没有任何(可见)错误:
FROM alpine:3
RUN apk --no-cache add transmission-cli transmission-daemon \
&& mkdir -p /transmission/config \
&& chmod -R 777 /transmission
RUN apk add --no-cache --upgrade bash
RUN wget -P ./transmission/ https://speed.hetzner.de/100MB.bin
ENV TRACKER_URL="http://104.219.73.18:6969/announce"
RUN echo tracker url is: ${TRACKER_URL}
RUN transmission-create -t ${TRACKER_URL} -o ./transmission/testfile.torrent /transmission/100MB.bin
CMD transmission-daemon -c ./transmission --config-dir ./transmission/
logs
对我没有任何显示。奇怪的是:如果我构建图像,在其中运行外壳并执行cmd
,一切都很好。我已经尝试将cmd
包装在bash脚本中,并执行了(因为为什么),但结果相同。
我想念什么?
The following docker image successfully builds but will just not run - without any (visible) error:
FROM alpine:3
RUN apk --no-cache add transmission-cli transmission-daemon \
&& mkdir -p /transmission/config \
&& chmod -R 777 /transmission
RUN apk add --no-cache --upgrade bash
RUN wget -P ./transmission/ https://speed.hetzner.de/100MB.bin
ENV TRACKER_URL="http://104.219.73.18:6969/announce"
RUN echo tracker url is: ${TRACKER_URL}
RUN transmission-create -t ${TRACKER_URL} -o ./transmission/testfile.torrent /transmission/100MB.bin
CMD transmission-daemon -c ./transmission --config-dir ./transmission/
The logs
show nothing for me. What's strange: If I build the image, run a shell inside it and execute the CMD
, everything runs just fine. I've already tried wrapping the CMD
in a bash script and executed that (because why not), but with the same result.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在命令行上运行
trainmission-daemon
自己,您会发现它会将自己置于后台。从Docker的角度来看,您的容器刚刚退出!您需要将
-f
(- 前景
)添加到tranmission-daemon
命令行:If you run
tranmission-daemon
yourself on the command line, you'll see that it puts itself into the background. From Docker's perspective, your container just exited!You need to add the
-f
(--foreground
) option to yourtranmission-daemon
command line: