cURL does not work on alpine

Just updated my Ubuntu 20.04 server, curl inside docker container stopped working.
Tried uninstalling and reinstalling docker according to the official guide. Docker version is

Docker version 20.10.21, build baeda1f

Tried running alpine with command line

sudo docker run --rm -it alpine
/ # apk add curl
(1/5) Installing ca-certificates (20220614-r0)
(2/5) Installing brotli-libs (1.0.9-r6)
(3/5) Installing nghttp2-libs (1.47.0-r0)
(4/5) Installing libcurl (7.83.1-r4)
(5/5) Installing curl (7.83.1-r4)
Executing busybox-1.35.0-r17.trigger
Executing ca-certificates-20220614-r0.trigger
OK: 8 MiB in 19 packages

So far so good, but running curl gives this error

/ # curl -v
* getaddrinfo() thread failed to start
* Could not resolve host:
* Closing connection 0
curl: (6) getaddrinfo() thread failed to start

Things that I have tried:

  1. curl works on the host machine

  2. nslookup works

/ # nslookup

Non-authoritative answer:

Non-authoritative answer:
Address: 2606:2800:220:1:248:1893:25c8:1946
  1. curl IP works
/ # curl
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
                <title>404 - Not Found</title>
                <h1>404 - Not Found</h1>
  1. Running with a security option (I have read that this might be the cause of the problem on older docker version). Gives out the same error
sudo docker run --security-opt seccomp=unconfined --rm -it alpine
  1. Curl works fine on ubuntu 16.04, 18.04 images.
  2. But not on ubuntu 20.04, fedora (latest) images. Same error message is given.

I have exhausted myself looking for solution. I think this is either DNS or C library problem. I was wondering if you guys can help me out with this.


So you have an Ubuntu 20.02 host and curl doesn’t work in an Ubuntu 20.04 container? How did you install Docker and what update did you run on the server? Simple apt upgrade?