如何更改“默认值" docker-machine的dns设置 [英] How to change "default" docker-machine's dns settings

查看:175
本文介绍了如何更改“默认值" docker-machine的dns设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用dns设置创建新的docker-机器

I know how to create a new docker-machine with dns settings

docker-machine create -d virtualbox --engine-opt dns=8.8.8.8 my_machine

但是已经有一个默认"虚拟机了,有没有办法改变它的dns?

But there is already a "default" virtualmachine so is there a way to change its dns?

我在线阅读了使用boot2docker进行此操作的方法,但该工具已被弃用,而docker-machine已将其替换.不幸的是,它太新了,以至于我在网上没有找到太多关于这个的东西.

I read online ways to do this with boot2docker, but that tool is deprecated and docker-machine has replaced it. Unfortunately, it's so new that I haven't found much online about this.

推荐答案

转到~/.docker/machine/machines/default/config.json并将您自己的DNS服务器添加到HostOptions/EngineOptions/Dns中,然后重新启动docker计算机.

Go to ~/.docker/machine/machines/default/config.json and add your own DNS server into HostOptions/EngineOptions/Dns and restart docker machine.

{  
   "HostOptions": {
        "Driver": "",
        "Memory": 0,
        "Disk": 0,
        "EngineOptions": {
            "ArbitraryFlags": [],
            "Dns": ["192.168.99.1","8.8.8.8","8.8.4.4"], <-- set it here
            "GraphDir": ""
        }
}

这篇关于如何更改“默认值" docker-machine的dns设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆