创建泊坞窗后如何更改其IP地址? [英] How to change the IP address of a docker after creating it?

查看:61
本文介绍了创建泊坞窗后如何更改其IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个泊坞窗链接到IP地址为 192.168.150.1/24 的网桥.一旦我从docker映像创建docker实例,它就会获得IP地址 192.168.150.2 ,但是根据我的要求,该IP地址 192.168.150.2 必须为保留,因为我想将其用于其他用途.

I have a docker linked to a bridge with IP address 192.168.150.1/24. Once I create the docker instance from a docker image it gets an IP address, 192.168.150.2, but according to my requirement, this IP address, 192.168.150.2, must be reserved since I want to use it for some other thing.

现在,我想将此Docker实例的IP地址更改为 192.168.150.3 .有可能吗?如果是这样怎么办?请帮助.

Now, I want to change the IP address of this docker instance as 192.168.150.3. Is it possible to do? if so how? Please, help.

推荐答案

您必须首先将容器与自定义网络分离,然后通过提供ip将其重新连接.

You will have to first detach the container from the custom network and the connect it back by providing the ip.

您可以按照以下步骤操作:

You can follow the following steps :

  1. docker网络断开连接[OPTIONS]网络容器
  2. docker network connect --ip 192.168.150.3网络容器

这篇关于创建泊坞窗后如何更改其IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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