Docker – Disable ip v6 in docker container


I have ipv6 enabled on docker host but there is one particular container where ipv6 is causing issues. Is there a way to launch a container without ipv6 support, either through command line argument or dockerfile directive?

Best Solution

Two options:

  1. Run docker with --dns-opt='options single-request'. See docs
  2. Run with --sysctl net.ipv6.conf.all.disable_ipv6=1. See discussion here