Etcd: Error while running etcd v3 on Docker

Created on 20 Dec 2016  路  11Comments  路  Source: etcd-io/etcd

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?

Most helpful comment

Ok this works. You need to specify the binary path in container image.

sudo docker run --name etcd0 quay.io/coreos/etcd:v3.0.0 \ 
    /etcd \
    --name my-etcd-1 \
    --listen-client-urls http://localhost:2379 \
    --advertise-client-urls http://localhost:2379 \
    --listen-peer-urls http://localhost:2380 \
    --initial-advertise-peer-urls http://localhost:2380 \
    --initial-cluster my-etcd-1=http://localhost:2380 \
    --initial-cluster-token my-etcd-token \
    --initial-cluster-state new

sudo docker run --name etcd0 quay.io/coreos/etcd:v3.1.0-rc.1 \
    /usr/local/bin/etcd \
    --name my-etcd-1 \
    --data-dir /var/lib/etcd \
    --listen-client-urls http://localhost:2379 \
    --advertise-client-urls http://localhost:2379 \
    --listen-peer-urls http://localhost:2380 \
    --initial-advertise-peer-urls http://localhost:2380 \
    --initial-cluster my-etcd-1=http://localhost:2380 \
    --initial-cluster-token my-etcd-token \
    --initial-cluster-state new

All 11 comments

This looks like Docker error? It works for me

sudo docker run --name etcd0 quay.io/coreos/etcd:v3.0.0

My docker version is 1.12.5

@gyuho It is working for you because you are not passing any arguments (like -listen-peer-urls).

You need to run the command like this till coreos fixes the issue:

docker run -d --name etcd --net host --entrypoint=/usr/local/bin/etcd quay.io/coreos/etcd:latest --listen-peer-urls 'http://0.0.0.0:2380' --listen-client-urls 'http://0.0.0.0:2379' --advertise-client-urls 'http://xxx.xxx.xxx.xxx:2379'

Ok this works. You need to specify the binary path in container image.

sudo docker run --name etcd0 quay.io/coreos/etcd:v3.0.0 \ 
    /etcd \
    --name my-etcd-1 \
    --listen-client-urls http://localhost:2379 \
    --advertise-client-urls http://localhost:2379 \
    --listen-peer-urls http://localhost:2380 \
    --initial-advertise-peer-urls http://localhost:2380 \
    --initial-cluster my-etcd-1=http://localhost:2380 \
    --initial-cluster-token my-etcd-token \
    --initial-cluster-state new

sudo docker run --name etcd0 quay.io/coreos/etcd:v3.1.0-rc.1 \
    /usr/local/bin/etcd \
    --name my-etcd-1 \
    --data-dir /var/lib/etcd \
    --listen-client-urls http://localhost:2379 \
    --advertise-client-urls http://localhost:2379 \
    --listen-peer-urls http://localhost:2380 \
    --initial-advertise-peer-urls http://localhost:2380 \
    --initial-cluster my-etcd-1=http://localhost:2380 \
    --initial-cluster-token my-etcd-token \
    --initial-cluster-state new

@romach @gourao Any feedback on specifying the exec path in the docker commands?
Please let us know if you have any other concerns. Thanks.

@gyuho is this documented anywhere, ask as in most places I see documentation for v2 for which it does not expect the binary path.

The document on coreos.com is not correct: doc.

still not fixed

@VsMax what's not fixed?

https://coreos.com/etcd/docs/latest/v2/docker_guide.html seems out of date; https://github.com/coreos/etcd/blob/master/Documentation/v2/docker_guide.md now forces the docker tag to v2.3.x so that the v2 docker guide is pinned to 2.x behavior

If it's out of date why it says /docs/latest?
Where can I find documentation regarding running etcd v3 in docker?
I have read a lot of coreos documentation and unfortunately with each artcle I am more and more confused how to setup a cluster:

  1. one tutorial uses etcd v2, other v3
  2. it is recommended to use ignition config, yet transpiler is very hard to find and use
  3. Don't know when and how to use (and debug) container linux config and when should I use ignition file( some kubernetes tutorials actually use container config file, not transpiled igntion file to setup a cluster).

I have to say it's all very confusing

If it's out of date why it says /docs/latest?

Because that's the latest doc sync, not the latest master. /cc @joshix

one tutorial uses etcd v2, other v3

Yes, there are still old docs around for those who need them.

it is recommended to use ignition config, yet transpiler is very hard to find and use

A doc that mentions the transpiler is currently in progress: https://github.com/gyuho/etcd/blob/58497d5172708c757af64181d0366729f3d823f8/Documentation/platforms/container-linux-systemd.md

Was this page helpful?
0 / 5 - 0 ratings

Related issues

r007m4n picture r007m4n  路  3Comments

suresh-chaudhari picture suresh-chaudhari  路  3Comments

kghost picture kghost  路  4Comments

jefurry picture jefurry  路  4Comments

olalonde picture olalonde  路  4Comments