moby/cmd/dockerd
Lukas Heeren ce61a1ed98
Adding ability to change max download attempts
Moby works perfectly when you are in a situation when one has a good and stable
internet connection. Operating in area's where internet connectivity is likely
to be lost in undetermined intervals, like a satellite connection or 4G/LTE in
rural area's, can become a problem when pulling a new image. When connection is
lost while image layers are being pulled, Moby will try to reconnect up to 5 times.
If this fails, the incompletely downloaded layers are lost will need to be completely
downloaded again during the next pull request. This means that we are using more
data than we might have to.

Pulling a layer multiple times from the start can become costly over a satellite
or 4G/LTE connection. As these techniques (especially 4G) quite common in IoT and
Moby is used to run Azure IoT Edge devices, I would like to add a settable maximum
download attempts. The maximum download attempts is currently set at 5
(distribution/xfer/download.go). I would like to change this constant to a variable
that the user can set. The default will still be 5, so nothing will change from
the current version unless specified when starting the daemon with the added flag
or in the config file.

I added a default value of 5 for DefaultMaxDownloadAttempts and a settable
max-download-attempts in the daemon config file. It is also added to the config
of dockerd so it can be set with a flag when starting the daemon. This value gets
stored in the imageService of the daemon when it is initiated and can be passed
to the NewLayerDownloadManager as a parameter. It will be stored in the
LayerDownloadManager when initiated. This enables us to set the max amount of
retries in makeDownoadFunc equal to the max download attempts.

I also added some tests that are based on maxConcurrentDownloads/maxConcurrentUploads.

You can pull this version and test in a development container. Either create a config
`file /etc/docker/daemon.json` with `{"max-download-attempts"=3}``, or use
`dockerd --max-download-attempts=3 -D &` to start up the dockerd. Start downloading
a container and disconnect from the internet whilst downloading. The result would
be that it stops pulling after three attempts.

Signed-off-by: Lukas Heeren <lukas-heeren@hotmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-19 13:51:40 +02:00
..
config.go Adding ability to change max download attempts 2019-09-19 13:51:40 +02:00
config_common_unix.go dockerd: fix rootless detection (alternative to #39024) 2019-04-25 16:47:01 +09:00
config_unix.go goimports: fix imports 2019-09-18 12:56:54 +02:00
config_unix_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
config_windows.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon.go DaemonCli: Move check into startMetricsServer 2019-09-12 15:18:05 +08:00
daemon_freebsd.go Windows: Wait for OOBE to prevent crashing during host update 2017-02-15 14:01:54 -08:00
daemon_linux.go Use go-systemd const instead of magic string in Linux version of dockerd 2018-05-23 19:06:34 +02:00
daemon_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon_unix.go Remove hack MalformedHostHeaderOverride 2019-07-18 21:25:04 +02:00
daemon_unix_test.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
daemon_windows.go Remove hack MalformedHostHeaderOverride 2019-07-18 21:25:04 +02:00
docker.go dockerd: fix rootless detection (alternative to #39024) 2019-04-25 16:47:01 +09:00
docker_unix.go Windows:Add ETW logging hook 2019-03-12 18:41:55 -07:00
docker_windows.go Windows:Add ETW logging hook 2019-03-12 18:41:55 -07:00
metrics.go goimports: fix imports 2019-09-18 12:56:54 +02:00
options.go allow running dockerd in an unprivileged user namespace (rootless mode) 2019-02-04 00:24:27 +09:00
options_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00
README.md Fix readme doc for dockerd 2016-09-01 14:47:51 +08:00
service_unsupported.go Split daemon service code to _windows file 2018-03-21 12:57:53 +01:00
service_windows.go cmd/dockerd: explicitly ignore unchecked errors (errcheck) 2019-09-18 12:57:53 +02:00

docker.go contains Docker daemon's main function.

This file provides first line CLI argument parsing and environment variable setting.