Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curl: (6) getaddrinfo() thread failed to start #682

Open
singhpreet89 opened this issue May 6, 2024 · 2 comments
Open

curl: (6) getaddrinfo() thread failed to start #682

singhpreet89 opened this issue May 6, 2024 · 2 comments

Comments

@singhpreet89
Copy link

The build finishes successfully on my machine. But I am getting the following error when I try to build the server on an AWS instance:

RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar
---> Running in 8d0181202ed0
curl: (6) getaddrinfo() thread failed to start
The command '/bin/sh -c curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar' returned a non-zero code: 6
ERROR: Service 'hapi-fhir' failed to build : Build failed

@singhpreet89
Copy link
Author

singhpreet89 commented May 6, 2024

Here is my Dockerfile:
FROM docker.io/library/maven:3.9.4-eclipse-temurin-17 AS build-hapi
WORKDIR /tmp/hapi-fhir-jpaserver-starter

ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.31.0
RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar

COPY pom.xml .
COPY server.xml .
RUN mvn -ntp dependency:go-offline

COPY src/ /tmp/hapi-fhir-jpaserver-starter/src/
COPY .env /tmp/hapi-fhir-jpaserver-starter/src/main/resources
RUN mvn clean install -DskipTests -Djdk.lang.Process.launchMechanism=vfork

FROM build-hapi AS build-distroless
RUN mvn package -DskipTests spring-boot:repackage -Pboot
RUN mkdir /app && cp /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /app/main.war

########### bitnami tomcat version is suitable for debugging and comes with a shell
########### it can be built using eg. docker build --target tomcat .
FROM bitnami/tomcat:9.0 AS tomcat

RUN rm -rf /opt/bitnami/tomcat/webapps/ROOT &&
mkdir -p /opt/bitnami/hapi/data/hapi/lucenefiles &&
chmod 775 /opt/bitnami/hapi/data/hapi/lucenefiles

USER root
RUN mkdir -p /target && chown -R 1001:1001 target
USER 1001

COPY --chown=1001:1001 catalina.properties /opt/bitnami/tomcat/conf/catalina.properties
COPY --chown=1001:1001 server.xml /opt/bitnami/tomcat/conf/server.xml
COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /opt/bitnami/tomcat/webapps/ROOT.war
COPY --from=build-hapi --chown=1001:1001 /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app

ENV ALLOW_EMPTY_PASSWORD=yes

########### distroless brings focus on security and runs on plain spring boot - this is the default image
FROM gcr.io/distroless/java17-debian11:nonroot AS default
USER 65532:65532
WORKDIR /app

COPY --chown=nonroot:nonroot --from=build-distroless /app /app
COPY --chown=nonroot:nonroot --from=build-hapi /tmp/hapi-fhir-jpaserver-starter/opentelemetry-javaagent.jar /app

ENTRYPOINT ["java", "--class-path", "/app/main.war", "-Dloader.path=main.war!/WEB-INF/classes/,main.war!/WEB-INF/,/app/extra-classes", "org.springframework.boot.loader.PropertiesLauncher"]

And here is my docker-compose.yml
hapi-fhir:
build: ../hapi-fhir
container_name: hapi-fhir
restart: on-failure
ports:
- "8080:8080"
depends_on:
- hapi-fhir-postgres
networks:
- test
hapi-fhir-postgres:
image: postgres:13-alpine
container_name: hapi-fhir-postgres
restart: always
environment:
POSTGRES_DB: "hapi"
POSTGRES_USER: "admin"
POSTGRES_PASSWORD: "admin"
ports:
- "5432:5432"
volumes:
- hapi-fhir-postgres:/var/lib/postgresql/data
networks:
- test
hapi-fhir-pgadmin:
image: dpage/pgadmin4
container_name: hapi-fhir-pgadmin
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: test
depends_on:
- hapi-fhir-postgres
ports:
- "5050:80"
volumes:
- hapi-fhir-pgadmin:/var/lib/pgadmin
networks:
- test
networks:
test:
driver: bridge
volumes:
hapi-fhir-postgres:
hapi-fhir-pgadmin:

@XcrigX
Copy link
Contributor

XcrigX commented May 7, 2024

This doesn't appear to have anything to do with HAPI. The curl command in your Dockerfile is returning an error.

Incidentally, I would guess it's a DNS/proxy/firewall issue of some sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants