Docker container -i -t
docker
https://docs.docker.com/engine/reference/run/#foreground
-t : Allocate a pseudo-tty
-i : Keep STDIN open even if not attached
docker run -t
1 | docker pull ubuntu:bionic-20200713 |
启动容器无 -i
参数时,执行 ls
等命令无回显,执行 exit
命令无法退出 container terminal
docker run -i
1 | docker run -i --rm ubuntu:bionic-20200713 /bin/bash |
启动容器无 -t
参数时,缺少常用的 terminal 功能,例如无当前登陆用户提示;但执行 ls
等命令正常有回显,且执行 exit
命令可退出
https://stackoverflow.com/questions/48368411/what-is-docker-run-it-flag
Without
-t
tag one can still interact with the container, but with it, you’ll have a nicer, more features terminal.
k8s
https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#container-v1-core
1 | // Variables for interactive containers, these have very specialized use-cases (e.g. debugging) |
1 | config := &runtimeapi.ContainerConfig{ |
use conda env in docker
https://pythonspeed.com/articles/activate-conda-dockerfile/
https://docs.conda.io/projects/conda/en/latest/commands/run.html
1 | conda run --no-capture-output -n my-python-env python --version |