docker run -e无法正常工作,发生错误了吗? [英] docker run -e not working, bug?
问题描述
根据文档:
此外,操作员可以在容器通过使用一个或多个-e标志,甚至覆盖那些标志上面提到的,或者已经由开发人员使用Dockerfile定义ENV.如果操作员在不指定名称的情况下命名环境变量值,则传播已命名变量的当前值进入容器的环境:
Additionally, the operator can set any environment variable in the container by using one or more -e flags, even overriding those mentioned above, or already defined by the developer with a Dockerfile ENV. If the operator names an environment variable without specifying a value, then the current value of the named variable is propagated into the container’s environment:
$ export today=Wednesday
$ docker run -e "deep=purple" -e today --rm alpine env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=d2219b854598
deep=purple
today=Wednesday
HOME=/root
我试图用我的容器运行docker run -e:
I tried to run docker run -e with my container:
docker run -d -it myimage123 -e "myvar=blah"
我收到此错误:
[FATAL tini (7)] exec -e failed: No such file or directory
推荐答案
尝试:
docker run -d -it -e"myvar = blah" myimage123
这里的问题是 -e
是一个标志,而 myimage123
是一个参数.因此,参数应始终位于标志之后.
The problem here is that -e
is a flag and myimage123
is an argument. So the arguments should always come after the flags.
这篇关于docker run -e无法正常工作,发生错误了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!