修改/etc/hosts对容器中的项目不生效问题解决
时间:2021-06-18 20:07:20
收藏:0
阅读:0
一、问题描述
容器中修改了/etc/hosts文件。手动测试已经生效。但是容器中的项目却还是访问的公网。
二、问题解决
修改dockerfile。在dockerfile中添加/etc/nsswitch.conf文件
RUN [ ! -e /etc/nsswitch.conf ] && echo ‘hosts: files dns‘ > /etc/nsswitch.conf
评论(0)