小编Roy*_*Roy的帖子

在python循环中执行time.sleep(1)时,docker卡住了

使用docker-composepython:2.7,它只在执行while 1循环和time.sleep(1)单独运行时正确运行.

但是当它们一起执行时它会停滞不前.

这是docker版本和我的文件内容 mac

tmp docker -v
Docker version 1.12.5, build 7392c3b
tmp cat docker-compose.yml
version: '2'
services:
    test:
        image: python:2.7
        command: [python, -c, "print 0\nwhile 1:\n\tprint 1\n\tbreak"]
tmp docker-compose up
Creating network "tmp_default" with the default driver
Creating tmp_test_1
Attaching to tmp_test_1
test_1  | 0
test_1  | 1
tmp_test_1 exited with code 0
tmp cat docker-compose.yml
version: '2'
services:
    test:
        image: python:2.7
        command: [python, -c, "print 0\nimport time\nprint time.sleep(1)"]
tmp …
Run Code Online (Sandbox Code Playgroud)

python sleep loops docker docker-compose

2
推荐指数
1
解决办法
961
查看次数

标签 统计

docker ×1

docker-compose ×1

loops ×1

python ×1

sleep ×1