Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1330622 - enhance condition judgement in /usr/bin/docker script
enhance condition judgement in /usr/bin/docker script
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker (Show other bugs)
7.2
x86_64 Linux
high Severity high
: rc
: ---
Assigned To: Lokesh Mandvekar
atomic-bugs@redhat.com
: Extras, ZStream
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-26 11:14 EDT by Alex Jia
Modified: 2016-05-12 11:18 EDT (History)
2 users (show)

See Also:
Fixed In Version: docker-1.9.1-37.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-12 11:18:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:1034 normal SHIPPED_LIVE Moderate: docker security, bug fix, and enhancement update 2016-05-12 15:15:01 EDT

  None (edit)
Description Alex Jia 2016-04-26 11:14:46 EDT
Description of problem:
The valid value only is /usr/bin/docker-current or /usr/bin/docker-latest for the argument DOCKERBINARY in /etc/sysconfig/docker, but we haven't any limitation for value of argument in /usr/bin/docker, a kind of bad case is user set DOCKERBINARY=/usr/bin/docker in /etc/sysconfig/docker then restart docker service, and restart command will hang forever. 

Version-Release number of selected component (if applicable):
# rpm -q docker docker-common
docker-1.9.1-33.el7.x86_64
docker-common-1.9.1-33.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. echo DOCKERBINARY=/usr/bin/docker >> /etc/sysconfig/docker
2. systemctl restart docker

Actual results:
# systemctl is-active docker
inactive

# systemctl is-active docker-latest
inactive

# systemctl restart docker

NOTE: hang forever.


Expected results:


Additional info:
Comment 1 Daniel Walsh 2016-04-26 12:03:35 EDT
We should catch this situation, but I would not say this is a blocker bug.
Comment 2 Lokesh Mandvekar 2016-04-26 12:34:52 EDT
While I'm still pushing fixes in, I could put something like: 

if [ ! -f ${DOCKERBINARY} ]; then
echo "Please set $DOCKERBINARY to /usr/bin/docker-current or /usr/bin/docker-latest"
else
exec ${DOCKERBINARY} $@
fi


wdyt?
Comment 3 Lokesh Mandvekar 2016-04-26 12:35:48 EDT
ugh ... that doesn't catch /usr/bin/docker
Comment 4 Lokesh Mandvekar 2016-04-26 12:37:23 EDT
if [ ${DOCKERBINARY} == "/usr/bin/docker ]; then
echo "Please set $DOCKERBINARY to /usr/bin/docker-current or /usr/bin/docker-latest"
else
exec ${DOCKERBINARY} $@
fi
Comment 5 Daniel Walsh 2016-04-26 13:10:32 EDT
Lokesh, where can I see the script?  Without having a RHEL system to install?
Comment 7 Daniel Walsh 2016-04-26 13:59:03 EDT
After looking at the script and at the packaging, only problem I have is we should not rename any of the plugins, they should work (eventually) with docker-latest or regular docker, (Once plugins are supported).
Comment 8 Lokesh Mandvekar 2016-04-26 22:26:50 EDT
Plugins are now docker-novolume-plugin, docker-rhel-push-plugin, docker-lvm-plugin. Those are docker-latest.

/usr/bin/docker now looks like this:

#!/bin/sh
. /etc/sysconfig/docker
[ -e "${DOCKERBINARY}" ] || DOCKERBINARY=/usr/bin/docker-current
if [ ! -f /usr/bin/docker-current ]; then
    DOCKERBINARY=/usr/bin/docker-latest
fi
if [[ ${DOCKERBINARY} != "/usr/bin/docker-current" && ${DOCKERBINARY} != /usr/bin/docker-latest ]]; then
    echo "DOCKERBINARY has been set to an invalid value:" $DOCKERBINARY
    echo ""
    echo "Please set DOCKERBINARY to /usr/bin/docker-current or /usr/bin/docker-latest
by editing /etc/sysconfig/docker"
else
    exec ${DOCKERBINARY} "$@"
fi


1. If _only_ docker-latest is installed, /usr/bin/docker calls /usr/bin/docker-latest
2. If docker is installed, /usr/bin/docker calls /usr/bin/docker-current unless set otherwise in /etc/sysconfig/docker
3. If DOCKERBINARY is set to anything other than /usr/bin/docker-current or /usr/bin/docker-latest, it'll prompt the user about invalid values and ask to set them to -current or -latest.

Fixed in upcoming build
Comment 10 Luwen Su 2016-04-30 23:40:47 EDT
In docker-1.9.1-38.el7.x86_64, works fine.

# echo DOCKERBINARY=/usr/bin/docker >> /etc/sysconfig/docker
# systemctl restart docker
# systemctl is-active docker
active
Comment 12 errata-xmlrpc 2016-05-12 11:18:28 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-1034.html

Note You need to log in before you can comment on or make changes to this bug.