first commit
This commit is contained in:
commit
ba848e218d
1001 changed files with 152333 additions and 0 deletions
18
CloudNative/Docker/docker容器指定ip.md
Normal file
18
CloudNative/Docker/docker容器指定ip.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
默认的bridge网络不支持指定IP地址
|
||||
```
|
||||
# docker run -itd --net bridge --ip 172.17.0.10 centos:latest /bin/bash
|
||||
6eb1f228cf308d1c60db30093c126acbfd0cb21d76cb448c678bab0f1a7c0df6
|
||||
docker: Error response from daemon: User specified IP address is supported on user defined networks only.
|
||||
```
|
||||
需要自定义网络
|
||||
```
|
||||
docker network create --subnet=172.18.0.0 /16 mynetwork
|
||||
```
|
||||
查看网络
|
||||
```
|
||||
docker network list
|
||||
```
|
||||
指定ip
|
||||
```
|
||||
docker run -itd --name networkTest1 --net mynetwork --ip 172.18.0.2 centos:latest /bin/bash
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue