@@ -139,6 +139,68 @@ The Docker client will honor the `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`
139139environment variables (or the lowercase versions thereof). ` HTTPS_PROXY ` takes
140140precedence over ` HTTP_PROXY ` .
141141
142+ ### Bind Docker to another host/port or a Unix socket
143+
144+ > ** Warning** :
145+ > Changing the default ` docker ` daemon binding to a
146+ > TCP port or Unix * docker* user group will increase your security risks
147+ > by allowing non-root users to gain * root* access on the host. Make sure
148+ > you control access to ` docker ` . If you are binding
149+ > to a TCP port, anyone with access to that port has full Docker access;
150+ > so it is not advisable on an open network.
151+
152+ With ` -H ` it is possible to make the Docker daemon to listen on a
153+ specific IP and port. By default, it will listen on
154+ ` unix:///var/run/docker.sock ` to allow only local connections by the
155+ * root* user. You * could* set it to ` 0.0.0.0:2375 ` or a specific host IP
156+ to give access to everybody, but that is ** not recommended** because
157+ then it is trivial for someone to gain root access to the host where the
158+ daemon is running.
159+
160+ Similarly, the Docker client can use ` -H ` to connect to a custom port.
161+ The Docker client will default to connecting to ` unix:///var/run/docker.sock `
162+ on Linux, and ` tcp://127.0.0.1:2376 ` on Windows.
163+
164+ ` -H ` accepts host and port assignment in the following format:
165+
166+ tcp://[host]:[port][path] or unix://path
167+
168+ For example:
169+
170+ - ` tcp:// ` -> TCP connection to ` 127.0.0.1 ` on either port ` 2376 ` when TLS encryption
171+ is on, or port ` 2375 ` when communication is in plain text.
172+ - ` tcp://host:2375 ` -> TCP connection on
173+ host:2375
174+ - ` tcp://host:2375/path ` -> TCP connection on
175+ host:2375 and prepend path to all requests
176+ - ` unix://path/to/socket ` -> Unix socket located
177+ at ` path/to/socket `
178+
179+ ` -H ` , when empty, will default to the same value as
180+ when no ` -H ` was passed in.
181+
182+ ` -H ` also accepts short form for TCP bindings:
183+
184+ `host:` or `host:port` or `:port`
185+
186+ Run Docker in daemon mode:
187+
188+ $ sudo <path to>/dockerd -H 0.0.0.0:5555 &
189+
190+ Download an ` ubuntu ` image:
191+
192+ $ docker -H :5555 pull ubuntu
193+
194+ You can use multiple ` -H ` , for example, if you want to listen on both
195+ TCP and a Unix socket
196+
197+ # Run docker in daemon mode
198+ $ sudo <path to>/dockerd -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock &
199+ # Download an ubuntu image, use default Unix socket
200+ $ docker pull ubuntu
201+ # OR use the TCP port
202+ $ docker -H tcp://127.0.0.1:2375 pull ubuntu
203+
142204### Daemon storage-driver option
143205
144206The Docker daemon has support for several different image layer storage
@@ -529,7 +591,7 @@ can specify default container isolation technology with this, for example:
529591
530592Will make ` hyperv` the default isolation technology on Windows. If no isolation
531593value is specified on daemon start, on Windows client, the default is
532- ` hyperv` , and on Windows server, the default is ` process` .
594+ ` hyperv` , and on Windows server, the default is ` process` .
533595
534596# # Daemon DNS options
535597
0 commit comments