Docker忽略入口点

运行下面的docker命令有一些奇怪的错误:

docker run -d \ --network="etcd" \ --ip 172.28.0.4 \ -v $(pwd)/etcd01:/etc/ssl/certs \ -p 4001:4001 -p 2380:2380 -p 2379:2379 \ --hostname etcd01 \ --name etcd01 quay.io/coreos/etcd:latest \ -name etcd01 \ -advertise-client-urls http://172.28.0.4:2379,http://172.28.0.4:4001 \ -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ -initial-advertise-peer-urls http://172.28.0.4:2380 \ -listen-peer-urls http://0.0.0.0:2380 \ -initial-cluster etcd01=http://172.28.0.4:2380,etcd01=http://172.28.0.2:2380,etcd02=http://172.28.0.3:2380 \ -initial-cluster-state new 

在etcd的Dockerfile中定义了一个ENTRYPOINT 。 Docker文档说,映像名称后的所有内容都作为parameter passing给入口点。 那为什么不呢?

我得到如下错误: docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"-name\": executable file not found in $PATH".

当然, -name不是命令。 这应该是etcd的第一个参数。

覆盖容器命令的概率值。 要执行这个动作,我build议你稍微修改你的命令:

 docker run -d \ --network="etcd" \ --ip 172.28.0.4 \ -v $(pwd)/etcd01:/etc/ssl/certs \ -p 4001:4001 -p 2380:2380 -p 2379:2379 \ --hostname etcd01 \ --name etcd01 quay.io/coreos/etcd:latest \ etcd \ -name etcd01 \ -advertise-client-urls http://172.28.0.4:2379,http://172.28.0.4:4001 \ -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \ -initial-advertise-peer-urls http://172.28.0.4:2380 \ -listen-peer-urls http://0.0.0.0:2380 \ -initial-cluster etcd01=http://172.28.0.4:2380,etcd01=http://172.28.0.2:2380,etcd02=http://172.28.0.3:2380 \ -initial-cluster-state new