当我尝试在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".
出现此错误的原因是什么以及如何解决?
答案 0 :(得分: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"
答案 1 :(得分: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
昨天,在停止容器并尝试再次运行它之后,我没有错误地运行图像。