github.com/tompao/docker@v1.9.1/docs/userguide/networking/default_network/options.md (about) 1 <!--[metadata]> 2 +++ 3 draft=true 4 title = "Tools and Examples" 5 keywords = ["docker, bridge, docker0, network"] 6 [menu.main] 7 parent = "smn_networking_def" 8 +++ 9 <![end-metadata]--> 10 11 <!--[metadata]> 12 We may want to add it back in later under another form. Labeled DRAFT for now. Won't be built. 13 <![end-metadata]--> 14 15 # Quick guide to the options 16 Here is a quick list of the networking-related Docker command-line options, in case it helps you find the section below that you are looking for. 17 18 Some networking command-line options can only be supplied to the Docker server when it starts up, and cannot be changed once it is running: 19 - `-b BRIDGE` or `--bridge=BRIDGE` -- see 20 21 [Building your own bridge](#bridge-building) 22 23 - `--bip=CIDR` -- see 24 25 [Customizing docker0](#docker0) 26 27 - `--default-gateway=IP_ADDRESS` -- see 28 29 [How Docker networks a container](#container-networking) 30 31 - `--default-gateway-v6=IP_ADDRESS` -- see 32 33 [IPv6](#ipv6) 34 35 - `--fixed-cidr` -- see 36 37 [Customizing docker0](#docker0) 38 39 - `--fixed-cidr-v6` -- see 40 41 [IPv6](#ipv6) 42 43 - `-H SOCKET...` or `--host=SOCKET...` -- 44 45 This might sound like it would affect container networking, 46 47 but it actually faces in the other direction: 48 49 it tells the Docker server over what channels 50 51 it should be willing to receive commands 52 53 like "run container" and "stop container." 54 55 - `--icc=true|false` -- see 56 57 [Communication between containers](#between-containers) 58 59 - `--ip=IP_ADDRESS` -- see 60 61 [Binding container ports](#binding-ports) 62 63 - `--ipv6=true|false` -- see 64 65 [IPv6](#ipv6) 66 67 - `--ip-forward=true|false` -- see 68 69 [Communication between containers and the wider world](#the-world) 70 71 - `--iptables=true|false` -- see 72 73 [Communication between containers](#between-containers) 74 75 - `--mtu=BYTES` -- see 76 77 [Customizing docker0](#docker0) 78 79 - `--userland-proxy=true|false` -- see 80 81 [Binding container ports](#binding-ports) 82 83 There are three networking options that can be supplied either at startup or when `docker run` is invoked. When provided at startup, set the default value that `docker run` will later use if the options are not specified: 84 - `--dns=IP_ADDRESS...` -- see 85 86 [Configuring DNS](#dns) 87 88 - `--dns-search=DOMAIN...` -- see 89 90 [Configuring DNS](#dns) 91 92 - `--dns-opt=OPTION...` -- see 93 94 [Configuring DNS](#dns) 95 96 Finally, several networking options can only be provided when calling `docker run` because they specify something specific to one container: 97 - `-h HOSTNAME` or `--hostname=HOSTNAME` -- see 98 99 [Configuring DNS](#dns) and 100 101 [How Docker networks a container](#container-networking) 102 103 - `--link=CONTAINER_NAME_or_ID:ALIAS` -- see 104 105 [Configuring DNS](#dns) and 106 107 [Communication between containers](#between-containers) 108 109 - `--net=bridge|none|container:NAME_or_ID|host` -- see 110 111 [How Docker networks a container](#container-networking) 112 113 - `--mac-address=MACADDRESS...` -- see 114 115 [How Docker networks a container](#container-networking) 116 117 - `-p SPEC` or `--publish=SPEC` -- see 118 119 [Binding container ports](#binding-ports) 120 121 - `-P` or `--publish-all=true|false` -- see 122 123 [Binding container ports](#binding-ports) 124 125 To supply networking options to the Docker server at startup, use the `DOCKER_OPTS` variable in the Docker upstart configuration file. For Ubuntu, edit the variable in `/etc/default/docker` or `/etc/sysconfig/docker` for CentOS. 126 127 The following example illustrates how to configure Docker on Ubuntu to recognize a newly built bridge. 128 129 Edit the `/etc/default/docker` file: 130 131 ``` 132 $ echo 'DOCKER_OPTS="-b=bridge0"' >> /etc/default/docker 133 ``` 134 135 Then restart the Docker server. 136 137 ``` 138 $ sudo service docker start 139 ``` 140 141 For additional information on bridges, see [building your own bridge](#building-your-own-bridge) later on this page.