Docker图像无声地无法启动

发布于 2025-02-06 02:37:03 字数 753 浏览 0 评论 0原文

以下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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梅倚清风 2025-02-13 02:37:06

如果您在命令行上运行trainmission-daemon自己,您会发现它会将自己置于后台。从Docker的角度来看,您的容器刚刚退出!

您需要将-f- 前景)添加到tranmission-daemon命令行:

CMD transmission-daemon -f -c ./transmission --config-dir ./transmission/

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 your tranmission-daemon command line:

CMD transmission-daemon -f -c ./transmission --config-dir ./transmission/
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文