I would suggest to debug this by step-by-step, and simplify your docker command while you debugging.
I can guest that your container does not start at all. What's in container logs?
So, if I debug that, I would remove every parameters first and run /bin/bash as a run command in an interactive mode, and check that internet is available from the container:
docker run -it --network=host --shm-size=1g --rm --name=test1 --privileged --entrypoint="" containerID /bin/bash
(containerID is actually the image name or image ID)
if everything is fine, I would suggest to add other parameters one-by-one, and check on which parameter you have the issue.
-u root
--dns 8.8.8.8
--cap-add=NET_ADMIN
--cap-add=SYS_ADMIN
--device=/dev/net/tun
--sysctl net.ipv6.conf.all.disable_ipv6=0
Another thing is it seems like having the --net=host
and --sysctl net.ipv6.conf.all.disable_ipv6=0
is not really right thing, because in that case you'll change parameters of the host machine, because you don't have a separate network stack as when you run without --net=host
.
I think that possible reasons of the error are:
- your VM provider does not allow to change net.ipv6.conf.all.disable_ipv6=0
- you have problems with your installed packages in Dockerfile (do you use it for building the container, or just upload the container image itself?). you should look at docker logs (probably you need to remove --rm
to get them)
- you have some mistakes in configs for your application, for example hardcoded IP-addresses, or DNS names, which does not exists in a server-side environment.
I believe that following these steps you can find the actual reason, and solve the problem. Good luck.