0
當我啓動docker守護進程時,我正在修改dns服務器,以便容器修改了/etc/resolv.conf。望着用法消息我看到:docker命令行參數
$ docker --help
Usage: docker [OPTIONS] COMMAND [arg...]
A self-sufficient runtime for linux containers.
Options:
--api-enable-cors=false Enable CORS headers in the remote API
-b, --bridge="" Attach containers to a prexisting network bridge
use 'none' to disable container networking
--bip="" Use this CIDR notation address for the network bridge's IP, not compatible with -b
-D, --debug=false Enable debug mode
-d, --daemon=false Enable daemon mode
--dns=[] Force Docker to use specific DNS servers
--dns-search=[] Force Docker to use specific DNS search domains
-e, --exec-driver="native" Force the Docker runtime to use a specific exec driver
... etc ...
的--dns是我想傳遞的東西,它顯示了一個帶有[],其中大部分經過反覆試驗,我終於得到這個工作「清單」:
--dns 127.0.0.1 --dns 8.8.8.8
其中存款:
nameserver 127.0.0.1
nameserver 8.8.8.8
到/etc/resolv.conf文件
。
這是向docker(大概是任何程序)提供列表的正確方法嗎?
這是他們使用標誌包的方式。很多去程序使用標誌來做這樣的列表選項,但沒有理由他們不能使用引用列表或逗號分隔列表。 – JimB 2015-03-13 18:11:17