windows - Docker- 为什么 docker 更新主机文件?

标签 windows docker

我是 docker 的新手。我得到了最新的 docker (18.06.1-ce-win73 (19507)),这个版本会以某种方式修改主机文件,我公司的安全团队阻止任何人修改文件。当我们请求授予权限但他们需要了解Docker为什么修改Hosts文件时。

那么谁能解释一下为什么它在启动时修改文件?

谢谢

enter image description here

最佳答案

我也是 docker 的新手。 但是,阅读这篇文章 (How to update /etc/hosts file in Docker image during "docker build") 我了解到您可以在“docker build”期间更新您的/etc/hosts 文件。

使用较新版本的 docker,这可以通过 docker-compose 及其额外的 hosts directive 来完成(你的版本在这里)

Add hostname mappings. Use the same values as the docker run client --add-host parameter (which should already be available for docker 1.8).

extra_hosts:
 - "somehost:162.242.195.82"
 - "otherhost:50.31.209.229"

简而言之:在运行时修改容器的/etc/hosts,而不是构建它。

关于windows - Docker- 为什么 docker 更新主机文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52164876/

相关文章:

windows - 在 Windows 上更改 GTK+3 外观

amazon-web-services - 当docker容器停止时停止AWS ECS Fargate任务

docker - Golang Dockerfile 权限被拒绝

docker - Kubernetes NFS 持久卷权限被拒绝

bash - Bash:从docker-compose.yml获取容器名称列表

调用 free 导致程序抛出异常

c++ - 媒体基础 : WavSink spools audio faster than real time consumption rate - can spooling be constrained real-time?

c# - 在 Linux 上使用 C# 进行开发

php - 在 Windows 上使用 PHP 获取共享驱动器列表?

wordpress - 如何将docker容器中的目录挂载到主机上?