当我尝试在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".
这个错误的原因是什么以及我如何修复它?
正如评论中所提到的,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"
我有以下错误:
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
昨天我在停止容器并尝试再次运行后运行了没有错误的图像我遇到了这些问题。