From 7f9d3268bf0e1d4a79d07c67e22eb14d3de96f6c Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Fri, 3 Jan 2014 18:07:43 -0800 Subject: [PATCH] Allow fd:// like unix:// and tcp:// Somthing like 20605eb310f0b57bd06eea80ec63c5022fc83bde Docker-DCO-1.1-Signed-off-by: Brandon Philips (github: philips) --- contrib/init/systemd/socket-activation/docker.service | 2 +- docs/sources/reference/commandline/cli.rst | 4 ++-- pkg/systemd/listendfd.go | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/init/systemd/socket-activation/docker.service b/contrib/init/systemd/socket-activation/docker.service index 0b39c2832..405bdf5af 100644 --- a/contrib/init/systemd/socket-activation/docker.service +++ b/contrib/init/systemd/socket-activation/docker.service @@ -5,7 +5,7 @@ After=network.target [Service] ExecStartPre=/bin/mount --make-rprivate / -ExecStart=/usr/bin/docker -d -H fd://* +ExecStart=/usr/bin/docker -d -H fd:// [Install] WantedBy=multi-user.target diff --git a/docs/sources/reference/commandline/cli.rst b/docs/sources/reference/commandline/cli.rst index e9809156d..739e93975 100644 --- a/docs/sources/reference/commandline/cli.rst +++ b/docs/sources/reference/commandline/cli.rst @@ -63,8 +63,8 @@ the ``-H`` flag for the client. # both are equal -To run the daemon with `systemd socket activation `, 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``. +To run the daemon with `systemd socket activation `, 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``. 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 `. diff --git a/pkg/systemd/listendfd.go b/pkg/systemd/listendfd.go index a8fdb09ca..08070b6ec 100644 --- a/pkg/systemd/listendfd.go +++ b/pkg/systemd/listendfd.go @@ -17,6 +17,11 @@ func ListenFD(addr string) ([]net.Listener, error) { return nil, errors.New("No sockets found") } + // default to all fds just like unix:// and tcp:// + if addr == "" { + addr = "*" + } + fdNum, _ := strconv.Atoi(addr) fdOffset := fdNum - 3 if (addr != "*") && (len(files) < int(fdOffset)+1) {