我想创建隔离的环境以在其中运行修改后的python解释器。 我有docker-compose.yaml:
version: '3.5'
services:
cpython:
image: ubuntu
ports:
- "7777:7777"
volumes:
- /home/myuser/workspace/cpython:/docker
working_dir: /docker
# stdin_open: true
# tty: true
command: /docker/python /docker/Tools/scripts/pydoc3 -p 7777
但是启动docker-compose up
时我得到了:
myuser@myuser-laptop:~/workspace/cpython$ docker-compose up
Recreating cpython_cpython_1 ...
Recreating cpython_cpython_1 ... done
Attaching to cpython_cpython_1
cpython_1 | Server ready at http://localhost:7777/
cpython_1 | Server commands: [b]rowser, [q]uit
cpython_1 | server>
cpython_1 | Server stopped
cpython_cpython_1 exited with code 0
为什么命令/docker/python /docker/Tools/scripts/pydoc3 -p 7777
被停止了?在我的主机终端中,它工作正常。
答案 0 :(得分:1)
好像没有打开交互式终端。试试:
docker run -it -p 7777:7777 -v /home/myuser/workspace/cpython:/docker ubuntu /docker/python /docker/Tools/scripts/pydoc3 -p 7777