Skip to content

Instantly share code, notes, and snippets.

@slavanap
Created July 18, 2020 13:26
Show Gist options
  • Save slavanap/c44c65677fd6fa3ee075b6a4854a029b to your computer and use it in GitHub Desktop.
Save slavanap/c44c65677fd6fa3ee075b6a4854a029b to your computer and use it in GitHub Desktop.
AWS ECS
FROM alpine
RUN apk add iptables
CMD /sbin/sysctl -w net.ipv4.conf.all.route_localnet=1 \
&& /sbin/iptables -t nat -A PREROUTING -p tcp -d 169.254.170.2 --dport 80 -j DNAT --to-destination 127.0.0.1:51679 \
&& /sbin/iptables -t nat -A OUTPUT -d 169.254.170.2 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 51679 \
&& sleep 100000000000000
# docker build -t ecs-init -f ecs-init.dockerfile .
# docker run --name ecs-init -d --restart=always --net=host --privileged ecs-init
# docker run --name ecs-agent -d --restart=always --volume=/var/run:/var/run --volume=/var/log/ecs/:/log --volume=/var/lib/ecs/data:/data --volume=/etc/ecs:/etc/ecs --net=host --env-file=/etc/ecs/ecs.config amazon/amazon-ecs-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment