Search code examples
dockeretcd

Docker ignores ENTRYPOINT


There are some weird errors running the following docker command:

docker run -d \
    --network="etcd" \
    --ip 172.28.0.4 \
    -v $(pwd)/etcd01:/etc/ssl/certs \
    -p 4001:4001 -p 2380:2380 -p 2379:2379 \
    --hostname etcd01 \
    --name etcd01 quay.io/coreos/etcd:latest \
    -name etcd01 \
    -advertise-client-urls http://172.28.0.4:2379,http://172.28.0.4:4001 \
    -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
    -initial-advertise-peer-urls http://172.28.0.4:2380 \
    -listen-peer-urls http://0.0.0.0:2380 \
    -initial-cluster etcd01=http://172.28.0.4:2380,etcd01=http://172.28.0.2:2380,etcd02=http://172.28.0.3:2380 \
    -initial-cluster-state new

There is an ENTRYPOINT defined in etcd's Dockerfile. And the docker docs say that everything after the image name is handed over as params to the entrypoint. Then why isn't it?

I get errors like: docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"-name\": executable file not found in $PATH".

Of course -name is not the command. It is supposed to be the first argument to etcd.


Solution

  • The probelmas that are overwriting the command of the container. To perform this action I recommend that you modify your command a little:

    docker run -d \
        --network="etcd" \
        --ip 172.28.0.4 \
        -v $(pwd)/etcd01:/etc/ssl/certs \
        -p 4001:4001 -p 2380:2380 -p 2379:2379 \
        --hostname etcd01 \
        --name etcd01 quay.io/coreos/etcd:latest \
        etcd \
        -name etcd01 \
        -advertise-client-urls http://172.28.0.4:2379,http://172.28.0.4:4001 \
        -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
        -initial-advertise-peer-urls http://172.28.0.4:2380 \
        -listen-peer-urls http://0.0.0.0:2380 \
        -initial-cluster etcd01=http://172.28.0.4:2380,etcd01=http://172.28.0.2:2380,etcd02=http://172.28.0.3:2380 \
        -initial-cluster-state new