Accepting request 417964 from Virtualization:containers

1

OBS-URL: https://build.opensuse.org/request/show/417964
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/docker?expand=0&rev=40
This commit is contained in:
Dominique Leuenberger 2016-08-09 20:15:50 +00:00 committed by Git OBS Bridge
commit b23cd2c1da
3 changed files with 75 additions and 66 deletions

28
docker-update-message.txt Normal file
View File

@ -0,0 +1,28 @@
*** WARNING ***
The docker service has not been restarted.
In the migration from docker<1.10.0 to docker>=1.10.0, the Docker image format
has changed to be completely content-addressible. This results in several positive
improvements to image operations (better caching during builds mainly). However,
the migration operation may take several hours if you have a lot of large images
on a Docker host. In order to ensure that you have minimum downtime, the docker
service has not been restarted as it will trigger this migration. You may either
restart this service at a time of your choosing or manually run the separate
migration tool (which will not cause downtime for your Docker daemon).
You can run the migration with this command, which will exit after the migration
has been completed:
$ %{_libexecdir}/docker-image-migrator/do-image-migration-v1to2.sh
Because the migrator requires information about the storage driver used by Docker,
the migration script will source %{_sysconfdir}/sysconfig/docker and use \$DOCKER_OPTS as
arguments to the migrator. If this automated migration fails, it will be re-attempted
with every known storage driver. In addition, the script accepts arguments which
will simiarly be appended to the set of arguments (after \$DOCKER_OPTS) to the
migrator.
Restarting docker without running this separate migration tool, WILL CAUSE DOWNTIME,
BECAUSE DOCKER WILL RUN THE MIGRATION ON FIRST START AND YOU WILL BE UNABLE TO START
ANY CONTAINERS OR USE ANY DOCKER COMMANDS (EVEN CONTAINERS WITH RESTART POLICIES ACTIVE):

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jul 25 05:34:50 UTC 2016 - sflees@suse.de
- Don't exit mid install, add the ability to not restart the docker
service during certain updates with long migration phases
bsc#980555
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jul 19 17:03:32 UTC 2016 - jmassaguerpla@suse.com Tue Jul 19 17:03:32 UTC 2016 - jmassaguerpla@suse.com

View File

@ -17,13 +17,19 @@
# nodebuginfo # nodebuginfo
%define docker_store %{_localstatedir}/lib/docker %global docker_store %{_localstatedir}/lib/docker
%global docker_migration_testfile %{docker_store}/.suse-image-migration-v1to2-complete
%global docker_migration_warnfile %{docker_store}/docker-update-message.txt
%define docker_graph %{docker_store}/graph %define docker_graph %{docker_store}/graph
%define docker_migration_testfile %{docker_store}/.suse-image-migration-v1to2-complete
%define git_version 9e83765 %define git_version 9e83765
%define go_arches %ix86 x86_64 aarch64 %define go_arches %ix86 x86_64 aarch64
%define version_unconverted 1.11.2 %define version_unconverted 1.11.2
%define __arch_install_post export NO_BRP_STRIP_DEBUG=true %define __arch_install_post export NO_BRP_STRIP_DEBUG=true
# When upgrading to a new version requires the service not to be restarted
# Due to a long migration process update last_migration_version to the new version
# that will first perform the migration, last time this was needed was version
# 1.10.1
%global last_migration_version 1.10.1
Name: docker Name: docker
Version: 1.11.2 Version: 1.11.2
Release: 0 Release: 0
@ -38,6 +44,7 @@ Source4: sysconfig.docker
Source6: docker-rpmlintrc Source6: docker-rpmlintrc
Source7: README_SUSE.md Source7: README_SUSE.md
Source8: docker-audit.rules Source8: docker-audit.rules
Source9: docker-update-message.txt
# Required to overcome some limitations of gcc-go: https://groups.google.com/forum/#!msg/golang-nuts/SlGCPYkjxo4/4DjcjXRCqAkJ # Required to overcome some limitations of gcc-go: https://groups.google.com/forum/#!msg/golang-nuts/SlGCPYkjxo4/4DjcjXRCqAkJ
Patch101: gcc-go-patches.patch Patch101: gcc-go-patches.patch
Patch102: netlink_gcc_go.patch Patch102: netlink_gcc_go.patch
@ -233,13 +240,11 @@ install -d %{buildroot}%{_mandir}/man5
install -p -m 644 man/man5/Dockerfile.5 %{buildroot}%{_mandir}/man5 install -p -m 644 man/man5/Dockerfile.5 %{buildroot}%{_mandir}/man5
%endif %endif
install -D -m 0644 %{SOURCE9} %{buildroot}%{docker_migration_warnfile}
%fdupes %{buildroot} %fdupes %{buildroot}
%pre %pre
# We're currently inside rpmlint, which will cause us to fail the tests if it
# happens that the Docker install in the builder requires a migration.
if [[ -z "$BUILD_ROOT" ]]
then
# In order to make sure we don't print a scary warning when we shouldn't we # In order to make sure we don't print a scary warning when we shouldn't we
# need to test these things (in this order): # need to test these things (in this order):
# 1. Check that %{_localstatedir}/lib/docker actually exists (docker daemon has run). # 1. Check that %{_localstatedir}/lib/docker actually exists (docker daemon has run).
@ -248,65 +253,29 @@ then
# will stick around if it has been migrated -- which is why we need the # will stick around if it has been migrated -- which is why we need the
# MIGRATION_TESTFILE check). # MIGRATION_TESTFILE check).
# 4. Check that there are images in the graph/ directory. # 4. Check that there are images in the graph/ directory.
if [[ -d "%{docker_store}" && ( ! -f "%{docker_migration_testfile}" ) && -d "%{docker_store}" && -n "$(find "%{docker_store}" -maxdepth 1 -type d 2>/dev/null | grep -Ev '_tmp|^%{docker_store}$')" ]] if [[ -d "%{docker_store}" && -n "$(find "%{docker_store}" -maxdepth 1 -type d 2>/dev/null | grep -Ev '_tmp|^%{docker_store}$')" ]]; then
then # Check if currently installed version of docker is old enough to need migration.
CURRENT_DOCKER_VERSION=$(docker -v | sed 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/')
# This variable will contain the current docker version if migration is needed otherwise it will contain the upgrade point.
# Next time the docker package needs to be upgraded without restarting the service increase the 1.10.1 to the new version.
NEED_UPGRADE_VERSION=$(echo -e "$CURRENT_DOCKER_VERSION\n%{last_migration_version}" | sort -V | head -1)
if [ -n "$DOCKER_FORCE_INSTALL" ] if [[ $CURRENT_DOCKER_VERSION == $NEED_UPGRADE_VERSION ]]; then
then
echo >&2 "*** IGNORING DOWNTIME WARNING! FORCING INSTALLATION. ***"
else
cat >&2 <<EOF
*** WARNING ***
In the migration from docker<1.10.0 to docker>=1.10.0, the Docker image format
has changed to be completely content-addressible. This results in several positive
improvements to image operations (better caching during builds mainly). However,
the migration operation may take several hours if you have a lot of large images
on a Docker host. In order to ensure that you have minimum downtime, this update
of Docker will not complete successfully, and you will have the opportunity to
run a separate migration tool (which will not cause downtime for your Docker
daemon).
In order to run this migration tool, please install the 'docker-image-migrator'
package. You can run the migration with this command, which will exit after the
migration has been completed:
$ %{_libexecdir}/docker-image-migrator/do-image-migration-v1to2.sh
Because the migrator requires information about the storage driver used by Docker,
the migration script will source %{_sysconfdir}/sysconfig/docker and use \$DOCKER_OPTS as
arguments to the migrator. If this automated migration fails, it will be re-attempted
with every known storage driver. In addition, the script accepts arguments which
will simiarly be appended to the set of arguments (after \$DOCKER_OPTS) to the
migrator.
However, if you prefer to not run this separate migration tool, you can force this
update using the following command. THIS WILL CAUSE DOWNTIME, BECAUSE DOCKER WILL
RUN THE MIGRATION ON FIRST START AND YOU WILL BE UNABLE TO START ANY CONTAINERS
OR USE ANY DOCKER COMMANDS (EVEN CONTAINERS WITH RESTART POLICIES ACTIVE):
$ DOCKER_FORCE_INSTALL=1 sudo -E zypper up docker
EOF
# Fail the update.
exit 1
fi
fi
# In order to make sure that we don't accidentally cause problems with an
# upgrade to docker>=1.10.2, we'll touch the same file we tested in (2).
# -m701 is *not* a typo, it is necessary for certain syscalls with remapped
# root.
[[ -d "%{docker_store}" ]] || install -d -m701 %{docker_store} || :
touch %{docker_migration_testfile} touch %{docker_migration_testfile}
fi fi
fi
getent group docker >/dev/null || groupadd -r docker getent group docker >/dev/null || groupadd -r docker
%service_add_pre %{name}.service %{name}.socket %service_add_pre %{name}.service %{name}.socket
%post %post
if [ -e %{docker_migration_testfile} ]; then
cp %{docker_migration_warnfile} /var/adm/update-messages/docker
else
if [ -e %{docker_migration_warnfile} ]; then
rm %{docker_migration_warnfile}
fi
fi
%service_add_post %{name}.service %{name}.socket %service_add_post %{name}.service %{name}.socket
%{fillup_only -n docker} %{fillup_only -n docker}
@ -314,6 +283,10 @@ getent group docker >/dev/null || groupadd -r docker
%service_del_preun %{name}.service %{name}.socket %service_del_preun %{name}.service %{name}.socket
%postun %postun
if [ -e %{docker_migration_testfile} ]; then
rm %{docker_migration_testfile}
export DISABLE_RESTART_ON_UPDATE=yes
fi
%service_del_postun %{name}.service %{name}.socket %service_del_postun %{name}.service %{name}.socket
%files %files
@ -327,6 +300,7 @@ getent group docker >/dev/null || groupadd -r docker
%config %{_sysconfdir}/audit/rules.d/%{name}.rules %config %{_sysconfdir}/audit/rules.d/%{name}.rules
%{_udevrulesdir}/80-%{name}.rules %{_udevrulesdir}/80-%{name}.rules
%{_localstatedir}/adm/fillup-templates/sysconfig.docker %{_localstatedir}/adm/fillup-templates/sysconfig.docker
%{_localstatedir}/lib/docker/
%ifarch %{go_arches} %ifarch %{go_arches}
%{_mandir}/man1/docker-*.1%{ext_man} %{_mandir}/man1/docker-*.1%{ext_man}
%{_mandir}/man1/docker.1%{ext_man} %{_mandir}/man1/docker.1%{ext_man}