Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deb pkg stop service before upgrade, start after upgrade #22

Closed
wants to merge 1 commit into from
Closed

deb pkg stop service before upgrade, start after upgrade #22

wants to merge 1 commit into from

Conversation

andrewhsu
Copy link
Contributor

Similar to PR #20 restart docker service if needed for rpm upgrade, this PR addresses issue moby/moby#33688 Container can not start after docker engine upgrade from 17.03.1-ce to 17.06.0-ce-rc3 for deb packages.

This PR will stop the docker service if it is running in an upgrade scenario. It will then start the service after the new files are installed so that the new daemon is used to launch the service. Unlike rpm packages, installing the docker-ce deb package is always expected to finish by starting the service.

For reference, deb pkg script event hooks: https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-maintscripts

To build a xenial deb pkg:

$ make -C rpm ENGINE_DIR=/path/to/engine/code CLI_DIR=/path/to/cli/code ubuntu-xenial # deb will be in deb/debbuild

Signed-off-by: Andrew Hsu andrewhsu@docker.com

@andrewhsu
Copy link
Contributor Author

/cc @tiborvass @tianon @seemethere @tych0

Copy link
Contributor

@seemethere seemethere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tych0
Copy link

tych0 commented Jun 19, 2017

+1, thanks!


case "$1" in
upgrade)
invoke-rc.d docker stop || exit $?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewhsu what if docker was already stopped?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the result of that command will always be exit code 0

@@ -9,6 +9,9 @@ case "$1" in
fi
fi
;;
upgrade)
invoke-rc.d docker start || exit $?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewhsu what is the expected behavior when docker was not running?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected behaviour is to have docker service started after completion of install of a docker-ce deb package. this is what happens on a new install of a docker-ce deb package.

@tianon
Copy link
Contributor

tianon commented Jun 19, 2017

https://manpages.debian.org/stretch/debhelper/dh_installinit.1.en.html is probably a useful link to get an idea of the code we're getting automatically via #DEBHELPER#, and what knobs are available for tweaking it out-of-the-box (would go in rules under common on our dh_installinit invocation; although from what I can tell, this should already be the current behavior, so I'm not sure what's going wrong 😞).

@tiborvass
Copy link
Contributor

tiborvass commented Jun 19, 2017

@tianon if you get docker from http://apt.dockerproject.org/repo/pool/main/d/docker-engine/ and then update to https://download.docker.com/linux/ such as https://download.docker.com/linux/ubuntu/dists/xenial/pool/test/amd64/docker-ce_17.06.0~ce~rc4-0~ubuntu_amd64.deb then it "fails" (aka docker does not stop).

BUT, if you got docker from, say https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_17.03.1~ce-0~ubuntu-xenial_amd64.deb, it's the same docker version, but it was packaged by a different script (assuming the one in this repo). The old packaging was from docker/docker's contrib/

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
@andrewhsu
Copy link
Contributor Author

Closing this in favour of PR #24 also have deb pkg conflict docker-engine because tested with that one and it solves the problem.

@andrewhsu andrewhsu closed this Jun 20, 2017
@andrewhsu andrewhsu deleted the deb-restart branch June 20, 2017 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants