通过如下的文件启动容器后
version: "3.8"
services:
test:
image: python:3.10-slim
container_name: test
restart: always
status一直处于Restarting
>>> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39694c66a560 python:3.10-slim "python3" 4 seconds ago Restarting (0) Less than a second ago test
且执行如下命令报错:
>>> docker exec -i -t test bash
Error response from daemon: Container 39694c66a560e9b596ecb51bf678bbc0e5172329b2d9541aa57eda453d093623 is restarting, wait until the container is running
改成如下后解决文章来源:https://www.toymoban.com/news/detail-509483.html
version: "3.8"
services:
test:
image: python:3.10-slim
container_name: test
tty: true
参考:https://stackoverflow.com/a/63990209文章来源地址https://www.toymoban.com/news/detail-509483.html
到了这里,关于【Docker】解决docker-compose启动的容器一直处于restarting状态的问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!