Docker Community Forums

Share and learn in the Docker community.

No external connection with container on VM with CentOS 8

I just have setup VirtualBox on my MAC with CentOS 8 server and installed docker. I downloaded latest Jenkins container and tried to run it. But I always receive an failure with resolving ip for update site when calling docker run jenkins command.

[root@centos-server ~]# docker run jenkins 
Mar 31, 2020 2:41:40 PM hudson.model.UpdateCenter updateDefaultSite
WARNING: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail.

Running ping shows that ip address doesn’t seem to get resolved. Calling doesn’t work but corresponding ip address is working. But wget also has problems.

[root@centos-server ~]# docker run jenkins ping 
ping: Temporary failure in name resolution
[root@centos-server ~]# docker run jenkins ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=61 time=9.53 ms
64 bytes from icmp_seq=2 ttl=61 time=10.0 ms
[root@centos-server ~]# docker run jenkins wget
--2020-03-31 15:15:50--
Connecting to failed: No route to host.

I studied the internet and tried several adjustements to resolv.conf, stop firewall or similar. But nothing helped.
Using --network host is also no solution because I want to provide 8080 port for external use of Jenkins in my vm with -p 8080:8080 command. Combination of both parameters is not possible.

Then I gave it another try by using another VM in my Virtualbox having Ubuntu Desktop installed. I also installed docker and there I receive no problem. Jenkins container is able to connect to update site. Also ping is possible.

ahager@ubuntu-vm:~$ docker run jenkins ping -c 4
PING ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=61 time=9.14 ms
64 bytes from ( icmp_seq=2 ttl=61 time=9.56 ms
64 bytes from ( icmp_seq=3 ttl=61 time=11.0 ms
64 bytes from ( icmp_seq=4 ttl=61 time=11.3 ms

--- ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3027ms
rtt min/avg/max/mdev = 9.147/10.277/11.341/0.949 ms

Anybody has an idea what could be the problem? Both host systems, CentOS and Ubuntu, can access internet. But there seems to be a problem with routing or DNS on CentOS server compared to Ubuntu desktop.
Which files or configuration should I check?