gpt4 book ai didi

docker - Docker停止以0退出

转载 作者:行者123 更新时间:2023-12-02 20:49:14 25 4
gpt4 key购买 nike

我快疯了...。我不明白为什么我的容器在运行后立即停止。

这是我的Dockfile:

FROM debian:latest

ENV DEVICE name
ENV PASSWORD pass

COPY install.sh /
#debdir is a directory
COPY debdir /debdir
RUN chmod +x /install.sh

CMD ["/install.sh"]
EXPOSE 5000 5314

和install.sh:
#!/bin/bash
dpkg -i /debdir/*.deb
/opt/MXB/sbin/configure-fp.sh --user=$DEVICE --password=$PASSWORD --encryption-method="AES-128" --encryption-key="SECUR_ITY2014a" --use-proxy=false

你能帮助我吗?

当服务“mxb”完成启动时,容器将以0退出,而不是使用-i -t选项保留runnig,我也尝试了-dit。

我用这个运行:
sudo docker run -i -t -p 5000:5000 -p 5314:5314 -e "DEVICE=device" -e "PASSWORD=pass" --name iaso_mxb iaso_mxb

非常感谢。

日志:
sudo docker logs af6bbff2a4f1
Selecting previously unselected package mxb.
(Reading database ... 7562 files and directories currently installed.)
Preparing to unpack /debdir/mxb_~linux-1_amd64.deb ...
Verifying archive integrity... All good.
Uncompressing ......
'./var/log/BRMigrationTool/BRMigrationTool_2017_05_30.log' -> '/tmp/BRMigrationTool_2017_05_30.log'
Unpacking mxb (17.4.1.17122-1) ...
Setting up mxb (17.4.1.17122-1) ...
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for systemd (215-17+deb8u7) ...
Functional Process configuration tool, version 17.4.1.17122
Copyright (c) 2017 MXB

[ ok ] Starting ProcessController:.

Initialization in progress. It can take a while...
...
...
Functional process initialized successfully.

在这一点上,服务应继续运行。

最佳答案

只要您的容器中有东西要做,您的容器就可以生存
CMD
要么
ENTRYPOINT
Dockerfile的指令,然后退出。

顺便问一下,您期望它做什么?

Nginx容器启动Nginx,MongoDB启动MongoDB数据库...

这是正常现象,例如,您可以添加
;sleep infinity
在install.sh的末尾

关于docker - Docker停止以0退出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44268572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com