2

当我尝试在 Docker 上运行 etcd(版本 3.0.0)时:

sudo docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 4001:4001 -p 2380:2380 -p 2379:2379 \
 --name etcd quay.io/coreos/etcd:v3.0.0  \
 -name etcd0 \
 -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001 \
 -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
 -initial-advertise-peer-urls http://${HostIP}:2380 \
 -listen-peer-urls http://0.0.0.0:2380 \
 -initial-cluster-token etcd-cluster-1 \
 -initial-cluster etcd0=http://${HostIP}:2380 \
 -initial-cluster-state new

我有一个错误:

docker: Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"-name\\\": executable file not found in $PATH\"\n".

此错误的原因是什么以及如何解决?

4

1 回答 1

1

如评论中所述,quay.io/coreos/etcd:v3.0.0图像不包含ENTRYPOINT,而是选择CMD. 因此,如果您想提供所有参数,docker run您还需要指定命令:

docker run -p 2379:2379 --name etcd quay.io/coreos/etcd:v3.1.0 \
    /usr/local/bin/etcd \
        --advertise-client-urls http://0.0.0.0:2379 \
        --listen-client-urls http://0.0.0.0:2379 \
        --initial-advertise-peer-urls http://0.0.0.0:2380 \
        --listen-peer-urls http://0.0.0.0:2380 \
        --initial-cluster "default=http://0.0.0.0:2380"
于 2017-06-21T21:12:28.600 回答