This error…
…and this output…
…contradict each another. Inside the container and outside the container you get different certificates for Github.
Have you changed the network configuration for docker in any way in ~/.docker/config.json
or in /etc/docker/daemon.json
?