1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Allow fd:// like unix:// and tcp://

Somthing like 20605eb310

Docker-DCO-1.1-Signed-off-by: Brandon Philips <brandon.philips@coreos.com> (github: philips)
This commit is contained in:
Brandon Philips 2014-01-03 18:07:43 -08:00
parent 566fb31c88
commit 7f9d3268bf
3 changed files with 8 additions and 3 deletions

View file

@ -5,7 +5,7 @@ After=network.target
[Service] [Service]
ExecStartPre=/bin/mount --make-rprivate / ExecStartPre=/bin/mount --make-rprivate /
ExecStart=/usr/bin/docker -d -H fd://* ExecStart=/usr/bin/docker -d -H fd://
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -63,8 +63,8 @@ the ``-H`` flag for the client.
# both are equal # both are equal
To run the daemon with `systemd socket activation <http://0pointer.de/blog/projects/socket-activation.html>`, use ``docker -d -H fd://*``. To run the daemon with `systemd socket activation <http://0pointer.de/blog/projects/socket-activation.html>`, use ``docker -d -H fd://``.
Using ``fd://*`` will work perfectly for most setups but you can also specify individual sockets too ``docker -d -H fd://3``. Using ``fd://`` will work perfectly for most setups but you can also specify individual sockets too ``docker -d -H fd://3``.
If the specified socket activated files aren't found then docker will exit. If the specified socket activated files aren't found then docker will exit.
You can find examples of using systemd socket activation with docker and systemd in the `docker source tree <https://github.com/dotcloud/docker/blob/master/contrib/init/systemd/socket-activation/>`. You can find examples of using systemd socket activation with docker and systemd in the `docker source tree <https://github.com/dotcloud/docker/blob/master/contrib/init/systemd/socket-activation/>`.

View file

@ -17,6 +17,11 @@ func ListenFD(addr string) ([]net.Listener, error) {
return nil, errors.New("No sockets found") return nil, errors.New("No sockets found")
} }
// default to all fds just like unix:// and tcp://
if addr == "" {
addr = "*"
}
fdNum, _ := strconv.Atoi(addr) fdNum, _ := strconv.Atoi(addr)
fdOffset := fdNum - 3 fdOffset := fdNum - 3
if (addr != "*") && (len(files) < int(fdOffset)+1) { if (addr != "*") && (len(files) < int(fdOffset)+1) {