私信  •  关注

tgogos

tgogos 最近创建的主题
tgogos 最近回复了
5 年前
回复了 tgogos 创建的主题 » DOCKER PS显示空列表-虽然DOCKER告知容器存在

这里可能发生的事情:

  1. docker run ... 创建并启动容器
  2. 你的集装箱出口
  3. docker ps 没有列出已停止的容器(默认显示只是正在运行),因此它使您认为它不在那里。
  4. docker运行。。。 失败,因为您试图创建和运行一个具有已经存在的名称的容器。

进一步阅读:

5 年前
回复了 tgogos 创建的主题 » 创建自定义Docker Alpine图像

找到它了。您可以通过将存储库作为参数来安装任何软件包。

FROM alpine:3.7  
RUN apk add libgdiplus-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
5 年前
回复了 tgogos 创建的主题 » 为什么Docker容器总是重新启动?

添加 #!/bin/sh 到start.sh文件

#!/bin/sh
nginx -c /etc/nginx/nginx.conf
tail -f /dev/null

容器总是重新启动的原因:

AS Henry 在他的评论中指出,你的设置 --restart always 这样说的。一般来说,记住当 PID 1 容器停止/崩溃,然后容器退出。例如,容器显示如下内容:

(注意 PID 1 行,问题所在)

docker container exec -it lnmp top -n 1 -b
Mem: 2846060K used, 3256768K free, 62108K shrd, 83452K buff, 1102096K cached
CPU:   2% usr   2% sys   0% nic  95% idle   0% io   0% irq   0% sirq
Load average: 0.09 0.24 0.27 1/892 41
  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
   10     9 nginx    S    15372   0%   0   0% nginx: worker process
   12     9 nginx    S    15372   0%   5   0% nginx: worker process
   17     9 nginx    S    15372   0%   1   0% nginx: worker process
   11     9 nginx    S    15372   0%   7   0% nginx: worker process
   18     9 nginx    S    15372   0%   5   0% nginx: worker process
   15     9 nginx    S    15372   0%   4   0% nginx: worker process
   14     9 nginx    S    15372   0%   1   0% nginx: worker process
   16     9 nginx    S    15372   0%   4   0% nginx: worker process
    9     1 root     S    14924   0%   6   0% nginx: master process nginx -c /etc/nginx/nginx.conf
    1     0 root     S     1592   0%   1   0% {start.sh} /bin/sh /shell/start.sh
   34     0 root     R     1532   0%   4   0% top -n 1 -b
   13     1 root     S     1524   0%   2   0% tail -f /dev/null