1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/images
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
..
cache.go
image.go
image_builder.go LCOW: Fix FROM scratch 2019-05-14 15:55:59 -07:00
image_commit.go
image_delete.go fix docker rmi stucking 2019-08-19 18:28:37 +08:00
image_events.go
image_exporter.go
image_history.go Builder: Fix CI issues 2018-03-19 14:29:36 -07:00
image_import.go
image_inspect.go
image_prune.go goimports: fix imports 2019-09-18 12:56:54 +02:00
image_pull.go goimports: fix imports 2019-09-18 12:56:54 +02:00
image_push.go Revert "Remove the rest of v1 manifest support" 2019-06-18 00:36:01 +00:00
image_search.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
image_search_test.go Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
image_tag.go
image_unix.go
image_windows.go
images.go cli: fix images filter when use multi reference filter 2018-11-22 10:33:45 +08:00
locals.go goimports: fix imports 2019-09-18 12:56:54 +02:00
service.go Adding ability to change max download attempts 2019-09-19 13:51:40 +02:00