0
docker-compose
및 python:2.7
을 사용하면 while 1
루프와 time.sleep(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 docker-compose up
Recreating tmp_test_1
Attaching to tmp_test_1
test_1 | 0
test_1 | None
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\nwhile 1:\n\tprint time.sleep(1)"]
tmp docker-compose up
Recreating tmp_test_1
Attaching to tmp_test_1
하고 여기 stucks에 고정 표시기 버전과 파일 내용입니다.
고마워하는 이유와 방법을 알고 싶습니다. 감사합니다.
의미가 있습니다. 파이썬의 맨 페이지에는 내부 버퍼링에 대한 세부 사항이 있습니다. 감사. – Roy