Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable ip v6 in docker container

Tags:

docker

ipv6

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?

like image 280
Sergei Rodionov Avatar asked Jun 10 '15 07:06

Sergei Rodionov


People also ask

How do I disable IPv6 Docker compose?

To disable IPv6 on the mailcow network, open docker-compose. yml with your favourite text editor and search for the network section (it's near the bottom of the file). Change enable_ipv6: true to enable_ipv6: false : networks: mailcow-network: [...]

Does Docker use IPv4 or IPv6?

By default, docker uses AF_INET6 sockets which can be used for both IPv4 and IPv6 connections.

Does Docker work on IPv6?

6️⃣ Docker supports IPv6 addressing and IPv6 network builds. 🔇 But IPv6 is not enabled by default. 🔊 Here's how to turn on IPv6. 🧱 Plus how to build three different v6 networks; the default docker0 bridge network, a user-defined bridge network, and an IPvlan network with access to the public Internet.


2 Answers

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
like image 100
d3ming Avatar answered Sep 21 '22 05:09

d3ming


Its kind of tricky. I just had the same issue what I did was to run the container with the ip:

docker run --name YourDockerContainer -p 192.168.99.100:80:80

This will start the container on this ip: 192.168.99.100.

like image 35
tokhi Avatar answered Sep 22 '22 05:09

tokhi