运行以下docker命令时会出现一些奇怪的错误:
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
etcd's Dockerfile中定义了ENTRYPOINT。并且docker docs表示图像名称后面的所有内容都作为参数传递给入口点。那为什么不是呢?
我收到如下错误:docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"-name\": executable file not found in $PATH".
当然-name
不是命令。它应该是etcd
的第一个参数。
答案 0 :(得分:1)
覆盖容器命令的问题。要执行此操作,我建议您稍微修改一下命令:
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