Error with ECS container connecting to Service discovery endpoint

62 views Asked by At

I have a dockerfile that is build in alpine and the image built in alpine and the runner is on scratchthe image runs on AWS ECS and has to connect the an endpoint hosted by AWS service discovery to send logs on the AWS same account.

But the ECS containers fail to connect the the endpoint

"statsd failed to initialize:dial udp: lookup statsd.local: device or resource busy"

i pass the endpoint in the environment variables of the task definition of the ECS service.

In case i use the IP address of the endpoint instead the the DNS name of the endpoint it successfully connects and sends logs

Any help would be really appreciated

Dockerfile

FROM alpine:latest as builder
WORKDIR xxxxxxxxx


ENV GOROOT xxxxxxxxx 
ENV GOPATH /go 
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin 
ENV GOPRIVATE=xxxxxxxxxxxx 
ENV GO111MODULE=on
COPY *.go go.sum go.mod ./ 
COPY model ./model

RUN apt-get update && apt-get install -y --no-install-recommends libc6 && rm -rf /var/lib/apt/lists/*
RUN go mod tidy
RUN go build -mod=mod -a -o xxxxx -ldflags "-linkmode external -extldflags -static"
RUN apt-get install -y ca-certificates 

COPY assets/configs/ssl/* /usr/local/share/ca-certificates/ RUN update-ca-certificates


FROM scratch as runner
EXPOSE 443 
WORKDIR /root/ COPY --from=builder /lib64/ld-linux-x86-64.so.2 /lib64/
COPY --from=builder /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/ 
COPY --from=builder /lib/x86_64-linux-gnu/libnss_dns* /lib/x86_64-linux-gnu/ 
COPY --from=builder /lib/x86_64-linux-gnu/libresolv* /lib/x86_64-linux-gnu/ 
COPY --from=builder /lib/x86_64-linux-gnu/libnss_dns* /usr/lib/x86_64-linux-gnu/ 
COPY --from=builder /lib/x86_64-linux-gnu/libresolv* /usr/lib/x86_64-linux-gnu/ 
COPY --from=builder xxxxx  . 
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ 
COPY assets/configs/ssl/* /usr/local/share/ca-certificates/

any help fixing this would be really great.

0

There are 0 answers