3

I have rented a VPS Linux VC4-8 server from Strato and would like to deploy a few Docker containers on it. Unfortunately, the deployed containers do not have internet access or cannot resolve DNS. As a result, I can't run commands like RUN apk update in the build process.

I have already tried various solutions, but unfortunately without success. Here are a few threads that I have already read and tried:

The following is an example of my problem starting from a completely clean server (Ubuntu 22.04):

  1. ping 8.8.8.8 or ping google.com works flawlessly (on the host)

  2. Install Docker using the official instructions (Install using the apt repository)

  3. Run docker pull alpine and docker run --rm -it alpine:latest

  4. Attach to the alpine Container

    1. PING 8.8.8.8 (8.8.8.8): 56 data bytes
      ^C
      --- 8.8.8.8 ping statistics ---
      30 packets transmitted, 0 packets received, 100% packet loss
      
    2. / # ping google.com
      ping: bad address 'google.com'
      

I also tried these steps on another server (from Hetzner) and everything worked normally there.
The files, such as /etc/resolv.conf look almost the same on both servers.

resolv.conf on the Strato Server:

nameserver 127.0.0.53 
options edns0 trust-ad 
search .

resolv.conf on the Hetzner Server

nameserver 127.0.0.53
options edns0 trust-ad

The default 'bridge' network looks exactly the same when I run docker inspect bridge.
And when I compare the Container from both machines with docker inspect <container name> everything looks the same. Only the CgroupnsMode property is set to host on the running example and to private on the Strato Server (but I am not sure if this is a problem regarding the connectivity).

If I start the container with the --network host option, I can successfully set up the containers and also access the internet from inside the containers, but after that my Django container cannot find the Postgres container. I also think that this is not the preferred way to do this.

Does anyone have any idea what could be the reason that I have these problems with Docker on the Strato server?
I really don't know what else to try.

Thanks in advance for any help!

br, Brian

Brian
  • 55
  • 4
  • I have the same problem. I think it is a problem with Ubuntu 22.04 and Docker.... I hope anybody has a reason for this problem – Flo Jun 09 '23 at 11:17

1 Answers1

4

from the docker forum: https://forums.docker.com/t/docker-bridge-networking-does-not-work-in-ubuntu-22-04/136326/6

The problem is netplan, ubuntu 22.04 use netplan to adress ip via DHCP. You need to modify the file /etc/netplan/50-cloud-init.yaml and add en in front of the * :

network:
    ethernets:
        all:
            dhcp4: true
            dhcp6: true
            match:
                name: 'en*'
    renderer: networkd
    version: 2

this will force netplan to use DHCP only on interface en* and the docker interface is docker0

next apply the configuration and restart network:

netplan apply
sudo systemctl restart systemd-networkd

#Docker need to be restarted to request a new ip
sudo systemctl restart docker

Worked for my Strato V-Server with ubuntu 22.04.

Psychi
  • 56
  • 2