What is the entry point/command required to run an etcd container in ECS?

Viewed 1265

With all of the entry points and commands I've tried so far, I'm getting this error "no such file or directory." I need to: 1) Set an env variable for HostIP using a special curl request to AWS 2) Run the etcd container, giving it arguments that use $HostIP

It seems that it takes a string array, but I'm not sure how it works. I'm thinking the commands are:

/bin/sh -c "export export HostIP=$(curl -s 169.254.169.254/latest/meta-data/local-ipv4)"

and

etcd -advertise-client-urls http://${HostIP}:2379,http://${HostIP}:4001
 -other-similar-args...

but I need to change them to be comma separated.

1) How do I escape the commas/quotes? 2) Do I need to use a comma and start a new string for every space? 3) Does anyone have a working example???

Update: I made a custom container with an entrypoint.sh which contains this:

 #!/bin/sh export HOST=$(curl -s 169.254.169.254/latest/meta-data/local-hostname) export HostIP=$(curl -s 169.254.169.254/latest/meta-data/local-ipv4)

 /usr/local/bin/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

Now the issue is that the container starts up but uses localhost instead of 0.0.0.0 or the IP we fetch with curl from AWS. It seems to suffer some kind of error and falls back to localhost.

1 Answers
Related