Commit graph

23 commits

Author SHA1 Message Date
Bryan Boreham
68dab9bd09 Use the name of the first unix socket in DOCKER_OPTS
Otherwise the while loop waits forever, checking for
a filename made up of all the names.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2016-07-29 14:04:43 +01:00
Sebastiaan van Stijn
428d7337e8
Don't set ulimits (nproc)
There is a not-insignificant performance overhead for all containers (if
containerd is a child of Docker, which is the current setup) if rlimits are
set on the main Docker daemon process (because the limits
propogate to all children).

We recommend using cgroups to do container-local accounting.

This applies the change added in 8db61095a3
to other init scripts.

Note that nfile cannot be set to unlimited, and the limit
is hardcoded to 1048576 (2^20) , see:
http://stackoverflow.com/a/1213069/1811501

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-07-13 17:15:19 +02:00
Antonio Murdaca
1ac1b78b3a contrib: init: use dockerd
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-05-11 11:00:11 +02:00
Jess Frazelle
d47812dd1d Merge pull request #19886 from AndrewGuenther/185160-init-socket-fix
Wait to fire start event until socket is created
2016-02-03 17:38:52 -08:00
Vincent Woo
87a450a37f Allow disabling of colored Docker logs via daemon flag.
Signed-off-by: Vincent Woo <me@vincentwoo.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
2016-02-01 16:19:18 -05:00
Andrew Guenther
9f401254bd Wait to fire start event until socket is created
Previously, this check only worked if no host was specified and was
hard coded to check for "/var/run/docker.sock"

This change generalizes that check and captures any specified socket
and waits for it to be created.

Caveat: This will only check the first socket specified, but it is an
improvement over none at all.

Fixes #185160

Signed-off-by: Andrew Guenther <guenther.andrew.j@gmail.com>
2016-02-01 08:40:26 -08:00
Julien Pervillé
6f83dd22a3 Update upstart init script to start on filesystem (not only on local ones).
Signed-off-by: Julien Pervillé <julien.perville@perfect-memory.com>
2015-11-05 20:38:52 +01:00
David Calavera
346ce4f8d2 Update init scripts to use docker daemon.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-07-22 11:24:38 -07:00
David Calavera
d8592eaff8 Revert "contrib/init: unshare mount namespace for inits"
This reverts commit b6569b6b82.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-15 10:35:17 -07:00
David Xia
2f9e7a067a Increase upstart kill timeout to 20 seconds
Give Docker more time to kill containers before upstart kills Docker.
The default kill timeout is 5 seconds.
This will help decrease the chance of but not eliminate the chance of
orphaned container processes.

Signed-off-by: David Xia <dxia@spotify.com>
2015-05-20 14:20:46 -04:00
Vincent Batts
b6569b6b82 contrib/init: unshare mount namespace for inits
* openrc
* sysvinit-debian
* upstart

Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-04-23 14:08:37 -04:00
Lewis Marshall
302e3834a0 Prevent Upstart post-start stanza from hanging
Once the job has failed and is respawned, the status becomes `docker
respawn/post-start` after subsequent failures (as opposed to `docker
stop/post-start`), so the post-start script needs to take this into
account.

I could not find specific documentation on the job transitioning to the
`respawn/post-start` state, but this was observed on Ubuntu 14.04.2.

Signed-off-by: Lewis Marshall <lewis@lmars.net>
2015-03-31 01:56:16 +01:00
Arnaud Porterie
89bdaa35e0 Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-03-06 18:21:51 -08:00
David Röthlisberger
f42c0a53a3 upstart: Don't emit "started" event until docker.sock is available
Fixes #6647: Other upstart jobs that depend on docker by specifying
"start on started docker" would often start before the docker daemon was
ready, so they'd fail with "Cannot connect to the Docker daemon" or
"dial unix /var/run/docker.sock: no such file or directory".

This is because "docker -d" doesn't daemonize, it runs in the
foreground, so upstart can't know when the daemon is ready to receive
incoming connections. (Traditionally, a daemon will create all necessary
sockets and then fork to signal that it's ready; according to @tianon
this "isn't possible in Go"[1]. See also [2].)

Presumably this isn't a problem with systemd init with its socket
activation. The SysV init scripts may or may not suffer from this
problem but I have no motivation to fix them.

This commit adds a "post-start" stanza to the upstart configuration
that waits for the socket to be available. Upstart won't emit the
"started" event until the "post-start" script completes.[3]

Note that the system administrator might have specified a different path
for the socket, or a tcp socket instead, by customising
/etc/default/docker. In that case we don't try to figure out what the
new socket is, but at least we don't wait in vain for
/var/run/docker.sock to appear.

If the main script (`docker -d`) fails to start, the `initctl status
$UPSTART_JOB | grep -q "stop/"` line ensures that we don't loop forever.
I stole this idea from Steve Langasek.[4]

If for some reason we *still* end up in an infinite loop --I guess
`docker -d` must have hung-- then at least we'll be able to see the
"Waiting for /var/run/docker.sock" debug output in
/var/log/upstart/docker.log.

I considered using inotifywait instead of sleep, but it isn't worth
the complexity & the extra dependency.

[1] https://github.com/docker/docker/issues/6647#issuecomment-47001613
[2] https://code.google.com/p/go/issues/detail?id=227
[3] http://upstart.ubuntu.com/cookbook/#post-start
[4] https://lists.ubuntu.com/archives/upstart-devel/2013-April/002492.html

Signed-off-by: David Röthlisberger <david@rothlis.net>
2014-12-16 21:25:01 +00:00
Jessica Frazelle
6c60e8c784 Adding self to various maintainers files.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2014-09-29 15:43:07 -07:00
Jeffrey Bolle
c52889db27 Ensure networking is up before starting docker
This resolves a problem that I have been having where docker starts before networking is up. See issue #5944 for more details.

Docker-DCO-1.1-Signed-off-by: Jeffrey Bolle <jeffreybolle@gmail.com> (github: jeffreybolle)
2014-05-24 19:03:11 +01:00
unclejack
ba0c829291 contrib/init/upstart: start on local-filesystems
This changes the upstart init script to start on `local-filesystems`.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
2014-05-16 19:12:59 +03:00
Michael Gorsuch
73ee4879af upstart: use exec here so upstart can monitor the process and not just a shell
Docker-DCO-1.1-Signed-off-by: Michael Gorsuch <michael.gorsuch@gmail.com> (github: gorsuch)
2014-03-27 12:44:33 -05:00
Brian Goff
e27c635c06 Add upstart nofile/noproc similar to systemd init
Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
2014-03-18 16:27:20 -04:00
Tianon Gravi
b21f8872cc Fix init script cgroup mounting workarounds to be more similar to cgroupfs-mount and thus work properly
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-03-11 01:39:06 -06:00
Tianon Gravi
50082f792b Fix a few packaging bugs, including and especially a temporary patch to our upstart script to mount cgroups properly
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-03-10 03:27:46 -06:00
Tianon Gravi
7cf7dda87d Add /etc/default/docker support to upstart, too (mirroring sysvinit) 2013-11-11 11:13:16 -07:00
Tianon Gravi
c405d53b6e Add initial init scripts library, including systemd, sysvinit, upstart, and openrc 2013-10-17 12:03:49 -06:00