美文网首页
docker network命令详解

docker network命令详解

作者: CUFFS | 来源:发表于2017-06-02 16:55 被阅读605次

docker network --help 回车能显示所有相关命令提示

[root@]# docker network --help

Usage:  docker network COMMAND

Manage networks

Options:
      --help   Print usage

Commands:
  connect     Connect a container to a network
  create      Create a network
  disconnect  Disconnect a container from a network
  inspect     Display detailed information on one or more networks
  ls          List networks
  prune       Remove all unused networks
  rm          Remove one or more networks

Run 'docker network COMMAND --help' for more information on a command.

docker network command --help 查看具体命令的详细参数和用法

[root@]# docker network connect --help

Usage:  docker network connect [OPTIONS] NETWORK CONTAINER

Connect a container to a network

Options:
      --alias stringSlice           Add network-scoped alias for the container
      --help                        Print usage
      --ip string                   IP Address
      --ip6 string                  IPv6 Address
      --link list                   Add link to another container (default [])
      --link-local-ip stringSlice   Add a link-local address for the container

创建网络

[root@izwz9fnxall7j07rfgkvwqz seafile]# docker network create --help

Usage:  docker network create [OPTIONS] NETWORK

Create a network

Options:
      --attachable             Enable manual container attachment # 允许手动附加到容器
      --aux-address map        Auxiliary IPv4 or IPv6 addresses used by Network driver (default map[])
  -d, --driver string          Driver to manage the Network (default "bridge")
      --gateway stringSlice    IPv4 or IPv6 Gateway for the master subnet
      --help                   Print usage
      --internal               Restrict external access to the network
      --ip-range stringSlice   Allocate container ip from a sub-range
      --ipam-driver string     IP Address Management Driver (default "default")
      --ipam-opt map           Set IPAM driver specific options (default map[])
      --ipv6                   Enable IPv6 networking
      --label list             Set metadata on a network (default [])
  -o, --opt map                Set driver specific options (default map[])
      --subnet stringSlice     Subnet in CIDR format that represents a network segment
[root@izwz9fnxall7j07rfgkvwqz seafile]# 

比如 docker network create lzwj 网络默认采用桥接网络
docker network ls
[root@seafile]# docker network ls
NETWORK ID NAME DRIVER SCOPE
62180a9e2a6f bridge bridge local
d80fef8de8ba host host local
6a5ad5bc599c lzwj bridge local
[root@seafile]#

相关文章

网友评论

      本文标题:docker network命令详解

      本文链接:https://www.haomeiwen.com/subject/wwyufxtx.html