Docker 如何从正在运行的块命令容器中退出?
我使用以下内容Dockerfile构建了一个alphine测试图像:Docker 如何从正在运行的块命令容器中退出?,docker,containers,Docker,Containers,我使用以下内容Dockerfile构建了一个alphine测试图像: FROM rarenicks/alphine WORKDIR /app COPY ./src/ /app RUN echo 321 >> test.txt CMD tail -f test.txt 您可以看到CDMtail-f test.txt是一个block命令 当我将图像作为容器运行时: [root@att dockerfiles]# docker run alphine-test:v1.0 W
FROM rarenicks/alphine
WORKDIR /app
COPY ./src/ /app
RUN echo 321 >> test.txt
CMD tail -f test.txt
您可以看到CDMtail-f test.txt
是一个block命令
当我将图像作为容器运行时:
[root@att dockerfiles]# docker run alphine-test:v1.0
WARNING: IPv4 forwarding is disabled. Networking will not work.
321
^C
quit
^C
^Z
^P
^Z^X^C^
现在我无法退出容器。您需要以“交互模式”运行容器:
打开另一个终端窗口,然后
docker stop
集装箱。(并考虑制作<代码> CMD实际运行应用程序的一些东西。)
docker run --interactive --tty alphine-test:v1.0