In docker run command , there is --add-host option. This is not working for Windows container.
Same way there is a configuration option in a compose file , extra_host. This is also not working for windows container.
Is there any specific reason , this is not working for windows container ?
See docker source tree: this & this:
func (s *DockerSuite) TestRunAddHost(c *check.C) {
// Not applicable on Windows as it does not support --add-hostfunc (s *DockerSuite) TestRunCreateVolumeEtc(c *check.C) {
// While Windows supports volumes, it does not support --add-host hence
// this test is not applicable on Windows.
So, I guess this is the current limit for docker for windows although I don't know why they did not support it.
And, you are not alone here, see this discussion, and folks' suggestion is put next to Dockerfile as workaround:
RUN $file = $Env:windir+'\System32\drivers\etc\hosts'; `
'10.0.0.1 some.host.com' | Add-Content -PassThru $file;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With