etcd-io / etcd

Distributed reliable key-value store for the most critical data of a distributed system
https://etcd.io
Apache License 2.0
47.5k stars 9.74k forks source link

Error while running etcd v3 on Docker #18533

Closed lijie123bes closed 3 weeks ago

lijie123bes commented 3 weeks ago

Bug report criteria

What happened?

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 did you expect to happen?

normal start

How can we reproduce it (as minimally and precisely as possible)?

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

Anything else we need to know?

No response

Etcd version (please run commands below)

version 3.0.0

Etcd configuration (command line flags or environment variables)

# paste your configuration here

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

```console $ etcdctl member list -w table # paste output here $ etcdctl --endpoints= endpoint status -w table # paste output here ```

Relevant log output

No response

ivanvc commented 3 weeks ago

Hi @lijie123bes, Thanks for opening this issue. This request is more of a support question than a bug, so I'll transfer it to a discussion.

Trying to solve the issue:

  1. First, I noticed you're trying to use etcd v3.0.0. The oldest supported minor version is v3.4; I suggest using the latest version from that minor, v3.4.33 (or v3.5.15).
  2. The docker image doesn't define an entry point, so if you pass arguments, you must specify the command first.

So, this should work (I verified it does, indentation for clarity):

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.4.33 \
               etcd \
                   -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