Docker windows ipv6 issue

Hello! I have a question about disabling ipv6 in docker container on windows. Is it possible? Even I create network without ipv6 support (while I inspecting network it strictly says ‘“EnableIPv6”: false’ and also ipv6 disabled everywhere in guest OS network adapters) but container still using ipv6.

Im using Docker Desktop for Windows 4.13, container working on base image of MS windows server core ltsc 2022.

Yes, it is possible to disable IPv6 in a Docker container running on Windows. However, it can be a bit more complex than disabling it on a Linux host.

One way to disable IPv6 within a container is to use the netsh command to disable it in the guest OS. You can do this by adding the following command to your Dockerfile:

RUN netsh interface ipv6 set interface "Local Area Connection" admin=disable

This command disables IPv6 on the “Local Area Connection” network adapter. You may need to modify the command to match the specific name of the network adapter you are using.

Another way to disable IPv6 in the container is to disable it in the host system and make sure that the container inherits the host’s network settings. You can do this by adding the following command in your docker-compose file:

    ipv6: false

Please note that even after disabling IPv6 in the container, some applications may still try to use it, so you may need to modify their configuration or use a different version of the application that does not rely on IPv6.

Also, if you’re using Docker Desktop for Windows 4.13, it uses Hyper-V isolation to run the containers and it can be possible that the IPv6 is enabled on the virtual switch used by the Hyper-V. So you should also check the virtual switch properties and confirm that the IPv6 is disabled.

Thank you for answer but it doesnt help. I ran your command from inside of container, below the screen with errors

Can you try to run the following commands;

netsh interface teredo set state disabled
netsh interface ipv6 6to4 set state state=disabled undoonstop=disabled
netsh interface ipv6 isatap set state state=disabled

Seems like ipv6 still working

Sorry, it seems that docker doesn’t support IPv6 for Docker for Windows. The documentation is here.

True, but the question was not about trying to use IPv6 but trying to disable it. I only saw a Link Local IP address which might not be affected in a container by the settings suggested in this topic. Unfortunately I don’t use Windows containers enough to understand the reason and help.