如果Docker容器立即退出该怎么办

If you run a container using docker run and it immediately exits and every time you press the Start button in Docker Desktop it exits again, there is a problem.

如果您使用docker run运行一个容器,并且该容器立即退出,并且每次在Docker Desktop中按下“开始”按钮时,该容器都会再次退出,则存在问题。

The way to figure out what is wrong is to run docker logs, adding the name of the container at the end:

找出错误的方法是运行docker logs ,并在末尾添加容器名称:

You can also click the Container name in Docker Desktop, and it will show a list of logs:

您还可以在Docker Desktop中单击Container名称,它将显示日志列表:

In this case after a quick Google search I realized I used a single quote in my CMD command.

在这种情况下,经过Google的快速搜索后,我意识到我在CMD命令中使用了单引号。

Note that to fix problems like this, you need to remove the container, but also delete the image and rebuild it.

请注意,要解决此类问题,您需要删除容器,还要删除映像并重新生成它。

翻译自: https://flaviocopes.com/docker-container-exits/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值