Error while running etcd v3 on Docker

1.4k views Asked by At

When I try to run etcd (version 3.0.0) on Docker:

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

I have an error:

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".

What is the reason of this error and how I can fix it?

1

There are 1 answers

0
Lucas On

As mentioned in the comments, the quay.io/coreos/etcd:v3.0.0 image does not contain an ENTRYPOINT, instead opting for CMD. So, if you want to supply all the arguments on the docker run you will need to specify the command as well:

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"