fargatecli
fargatecli copied to clipboard
Allow passing arguments to docker
I am having problems creating a service behind the firewall at work.
Trying to run this command: fargate service create <name> --region <region> --lb <loadbalancer> --port 443
, which in turn runs docker build --rm=false --tag <tag> .
, I get to RUN apk update
in the docker file, which then fails with ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.9/main: network error (check Internet connection and firewall)
.
This is because of the proxy that our company network sits behind.
For some reason, docker does not pick up proxy env vars when running docker build, so even though $HTTP_PROXY
and friends are all set up, this fails.
A workaround is to add --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy
to the docker command, so if I run docker build --rm=false --tag <tag> . --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy
, everything works fine. This also currently works as a workaround, as the files will be cached, and subsequent builds with fargate
will run fine as docker does not try do actually download anything.
See https://github.com/moby/moby/issues/24697 for discussion about this behaviour in Docker. Would it be possible to add an argument to the fargate cli that can be used to pass arguments to docker?
Somewhat relevant
Dockerfile
FROM ...
ENV MY_ENV
RUN something $MY_ENV
I just recently realized that MY_ENV=foo fargate service deploy app
doesn't pass the environment variable to the Docker during the build.
Any thoughts?