docker_logo.png

After installing fresh "Ubuntu 22.04.3 LTS" I found one of my docker environment broken.
By previous setup containers should see each other by it's host names which is configured in traefik.

But all curl command were ended with this error.

cURL error 7: Failed to connect to test.my-docker.localhost port 443 after 0 ms: Couldn't connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://test.my-docker.localhost/

Also I've checked that container itself do not know about it's host name.
Digging into this issue I found that address of host ended on local host. But in old system I see correct IP address from docker network.
Here's the results of nslookup command inside container:

# nslookup test.my-docker.localhost
Server: 127.0.0.11 
Address: 127.0.0.11:53
                          
Name:   test.my-docker.localhost                                                                                                                                                                                                             
Address: ::1                                       
                                                          
Name:   test.my-docker.localhost                                                                                      
Address: 127.0.0.1  

For local ns resolver settings symlink is present at /etc/resolv.conf
And in new system there was these settings:

nameserver 127.0.0.53
options edns0 trust-ad ndots:0
search lan

On previous system options were absent at all. But the issue is with trust-ad option. I've tried to remove it with simple editing and restarting systemd-resolved.service.
Didn't helped. Also tried to edit file /run/systemd/resolve/stub-resolv.conf without any luck.
Because this file is managed by service and updated automatically.

 # sudo nano /run/systemd/resolve/stub-resolv.conf
 # sudo systemctl stop systemd-resolved.service
 # sudo systemctl start systemd-resolved.service

On one of the websites I found the trick to install resolvconf program to edit resolvers configs.

 # sudo apt install resolvconf
 # sudo systemctl start resolvconf.service
 # sudo systemctl enable resolvconf.service

It was installed, started and enabled. Without any additional actions and options were removed from /etc/resolv.conf file.
After starting docker container and checking nslookup it has correct values.

# nslookup test.my-docker.localhost
Server:         127.0.0.11
Address:        127.0.0.11:53
Non-authoritative answer:
Non-authoritative answer:
Name:   test.my-docker.localhost
Address: 172.18.0.2

And command curl started to work normally

curl -v test.my-docker.localhost

But it was not the end of my adventures and nightmares.
Running some of my local docker environments I found that issue was still present - curl wasn't working correct.
I was using php:8.1-fpm image. php version on my old machine was 8.1.7, but new container was created with the latest 8.1.23.
Changing it back to php:8.1.7-fpm fix the issue. Also I can use latest php version with php:8.1-fpm-bullseye image. Works fine.
But I still curious how this can be: new container was based on Debian 12 bookworm version! And curl was updated to the 7.88.1 version.
I had no time to check commits to curl repo and debian changes so it's good that it's working. Or maybe it's some configuration issue, like it was before on my host machine.

The one thing I figured out for myself is to use precise version of images in docker to prevent the cases, when updated image can break all my environment.

Below the information about software versions in containers.

image: php:8.1-fpm-bullseye
based on debian 11 bullseye

# php --version
PHP 8.1.23 (cli) (built: Sep 20 2023 19:35:44) (NTS)

# curl --version
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09

# uname -a
Linux e066bda8b1f1 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep  7 10:33:52 UTC 2 x86_64 GNU/Linux

image: php:8.1-fpm
based on debial 12 bookworm

# php --version
PHP 8.1.23 (cli) (built: Sep 20 2023 19:22:02) (NTS)

# curl --version
curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.9 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.10.0 nghttp2/1.52.0 librtmp/2.3
Release-Date: 2023-02-20

# uname -a
Linux 91be946a6b4f 6.2.0-33-generic #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep  7 10:33:52 UTC 2 x86_64 GNU/Linux

 

Add new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed.