在Docker上运行etcd v3时出错

问题描述 投票:2回答: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".

这个错误的原因是什么以及我如何修复它?

docker etcd etcd3
2个回答
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"

0
投票

我有以下错误:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"-e\": executable file not found in $PATH": unknown.

因此与v3.1.0和最新的

docker run --rm --name etcd -p 2379:2379 quay.io/coreos/etcd:v3.1.0 -e ETCDCTL_API=3 /usr/local/bin/etcd -advertise-client-urls http://0.0.0.0:2379 -listen-client-urls http://0.0.0.0:2379

昨天我在停止容器并尝试再次运行后运行了没有错误的图像我遇到了这些问题。

© www.soinside.com 2019 - 2024. All rights reserved.