2017-10-12 41 views
0

根據docs碼頭運行-e不工作,錯誤?

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 

我試圖用我的容器中運行的泊塢窗運行-e:

docker run -d -it myimage123 -e "myvar=blah" 

我得到這個錯誤:

[FATAL tini (7)] exec -e failed: No such file or directory 
+0

您的旗幟不應該放在'myimage123'之前嗎? – user2662833

回答

2

嘗試:

docker run -d -it -e "myvar=blah" myimage123

這裏的問題是-e是一個標誌,myimage123是一個參數。所以爭論應該總是在旗幟之後。