How did you install docker on Centos? Directly from the repositories of docker or from centos?
I'm guessing from the docker repository, because RHEL might not support docker anymore because of podman. But they're still backporting it on Centos 7.
I assume you have no problems with DNS on your Centos 8 VM, because otherwise you wouldn't have been able to install Docker at all (unless you've downloaded the rpms and copied them through other means, which I doubt).
I'm not sure if this is related to the changes RHEL have made lately (since being taken over by IBM), but I'm starting to becoms suspcious of their intentions. Anyhow, this has nothing to do with your vmware environment, it can't, because Centos works as expected, and then it's only the OS/docker daemon's job to provide the container with a proper dns service.
This is my experience with Centos 8 + docker:
Code:
[root@localhost ~]# docker ps
Error response from daemon: client version 1.40 is too new. Maximum supported API version is 1.39
[root@localhost ~]# rpm -qa | grep docker
docker-ce-18.09.1-3.el7.x86_64
docker-ce-cli-19.03.9-3.el7.x86_64
[root@localhost ~]# export DOCKER_API_VERSION=1.39
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
So from the start the client version is not set correctly (for whatever reason!) * actually most probably because the docker version is supposed to work on Centos 7, indeed.
After creating the container and entering it, I see that I don't get any DNS either. I find it suspcious that the nameserver is 192.168.0.1 (in my case). Normally it's supposed to be 127.0.0.11 - I'm not sure why you'd have 192.168.221.1 - that cannot be the default - you've either changed it or you are referring to the Centos 8 VM (the host).
Further tests show me that there's no internet connectivity at all from the container:
Code:
root@c2f42946cc00:/dev# exec 3<>/dev/tcp/172.217.20.110/80 # this is google's ip, port 80
bash: connect: No route to host
bash: /dev/tcp/8.8.8.8/: No route to host
I've no idea what's going on, but if you've tested Centos 8 on GCP, they've obviously adjusted it in such a way as to work. Are you sure it was Centos 8 and not 7 or another distro?
If you want to start learning as fast as possible, I suggest simply using Centos 7 (you can install it through docker repos or centos repo - backported, but then you'd get a much older version, but still maintained by centos/rhel) or Debian/Ubuntu. It works without any issues.
I have a bad feeling that Centos 8 has some clear issues, I've heard of official repositories being turned off, whatever. I just hope I'm mistaken and these were just misunderstandings/rumors.
One more important thing:
https://download.docker.com/linux/centos/
Docker doesn't seem to have released a version for Centos 8 at all - it might be related to the fact that RHEL has given up on officially supporting docker, I'm not sure. So that information alone could be enough for you to switch to another distro/version.
* I've posted without actually seeing the second page of this thread, but the post is still relevant and nomad had already offered important info on that.