Skip to content

DNS resolution failures in Alpine-based docker container #1355

@arturfromtabnine

Description

@arturfromtabnine

What Happened?

Portkey gateway running in Alpine-based docker container fails to resolve some DNS queries for external services, causing connectivity issue. Alpine based images are know for its issues with musl dns client, so in some cases it fails to resolve. https://gitlab.alpinelinux.org/alpine/aports/-/issues/9017?__goaway_challenge=cookie&__goaway_id=532e6a3acc2ec7453ce670715eb7a81f

Error Details

$ nslookup test.openai.azure.com
;; Got recursion not available from 10.44.0.10, trying next server
;; Got recursion not available from 2001:cafe:42:1::a
Server:		10.44.0.10
Address:	10.44.0.10#53

Non-authoritative answer:
test.openai.azure.com	canonical name = test.privatelink.openai.azure.com.
Name:	test.privatelink.openai.azure.com
Address: 10.104.2.4
;; Got SERVFAIL reply from 10.44.0.10, trying next server
;; Got SERVFAIL reply from 2001:cafe:42:1::a
** server can't find test.privatelink.openai.azure.com: SERVFAIL

What Should Have Happened?

Debian's dns resolver handle cluster's private endpoint DNS configuration in more graceful manner using glibc instead of musl
For the context, we had this issue on one of our clients installations where they do use hosted models / private endpoints. Having debian base image solved the issue.

Relevant Code Snippet

index 684a905..0f1c474 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 # Use the official Node.js runtime as a parent image
-FROM node:20-alpine AS build
+FROM node:20-slim AS build
 
 # Set the working directory in the container
 WORKDIR /app
@@ -8,8 +8,10 @@ WORKDIR /app
 COPY package*.json ./
 COPY patches ./
 
-# Upgrade system packages
-RUN apk update && apk upgrade --no-cache
+# Update system packages and install necessary dependencies
+RUN apt-get update && apt-get upgrade -y && apt-get install -y \
+    curl \
+    && rm -rf /var/lib/apt/lists/*
 
 # Upgrade npm to version 10.9.2
 RUN npm install -g [email protected]
@@ -22,14 +24,16 @@ COPY . .
 
 # Build the application and clean up
 RUN npm run build \
-&& rm -rf node_modules \
-&& npm install --omit=dev
+    && rm -rf node_modules \
+    && npm install --omit=dev
 
 # Use the official Node.js runtime as a parent image
-FROM node:20-alpine
+FROM node:20-slim
 
-# Upgrade system packages
-RUN apk update && apk upgrade --no-cache
+# Update system packages and install necessary dependencies
+RUN apt-get update && apt-get upgrade -y && apt-get install -y \
+    curl \
+    && rm -rf /var/lib/apt/lists/*
 
 # Upgrade npm to version 10.9.2
 RUN npm install -g [email protected]

Your Twitter/LinkedIn

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions