Bug 1463824

Summary: rpm tries to stop docker containers during fresh install (no upgrade)
Product: Red Hat Enterprise Linux 7 Reporter: Dusty Mabe <dustymabe>
Component: dockerAssignee: Frantisek Kluknavsky <fkluknav>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, dwalsh, fkluknav, jpazdziora, lsm5, lsu, myllynen, santiago
Target Milestone: rcKeywords: Extras
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:11:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rpm-install.txt none

Description Dusty Mabe 2017-06-21 20:11:30 UTC
Created attachment 1290300 [details]
rpm-install.txt

Description of problem:


See errors during fresh rpm install of docker. See attachment for full log. 

```
Stopping containers...
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
"docker stop" requires at least 1 argument(s).
See 'docker stop --help'.

Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]

Stop one or more running containers
```


Version-Release number of selected component (if applicable):
```
[root@n9 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 
[root@n9 ~]# 
[root@n9 ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@n9 ~]# rpm -q docker
docker-1.12.6-28.git1398f24.el7.centos.x86_64
```




How reproducible:
Always

Steps to Reproduce:
1. yum install -y docker from a fresh machine

Comment 2 Ed Santiago 2017-06-22 17:07:12 UTC
This is a reopening of bug 1450172.

FWIW, bug confirmed in docker-1.12.6-32.git88a4867.el7. Bug is *not* present in any 7.4 docker build I tested, e.g. docker-1.12.6-39.1.git6ffd653.el7, because the 7.4 branch of the specfile doesn't seem to have the 'docker stop' step.

One possible suggestion for replacing the scriptlet:

    if systemctl --quiet is-active docker.service; then
        running=$(/usr/bin/docker ps -a -q)
        test -n "$running" && /usr/bin/docker stop $running
    fi

This solves two problems:

   1) Message when docker daemon not running (e.g. first install, or upgrade if daemon is stopped):

       Cannot connect to the Docker daemon. Is the docker daemon running on this host?

   2) Message when docker daemon _is_ running but there are no active containers:

       "docker stop" requires at least 1 argument(s).
       See 'docker stop --help'.

       Usage:  docker stop [OPTIONS] CONTAINER [CONTAINER...]

       Stop one or more running containers

Comment 3 Daniel Walsh 2017-06-30 15:17:58 UTC
Franticek any movement on this bug?

Comment 4 Frantisek Kluknavsky 2017-07-02 11:21:38 UTC
The offending part of the scriptlet was removed by Lokesh in 7.4 some time ago. I removed that part in 7.3 now.

Comment 5 Frantisek Kluknavsky 2017-07-04 14:44:15 UTC
Currently, in 7.4, updating docker with a running container (with systemd inside) results in:

Sending SIGKILL to remaining processes...
Halting system.
Exiting container.
Error response from daemon: Driver devicemapper failed to remove root filesystem a67fc08a170b5564a88a188f1ec5d25d78f89e4734e7f64bee09c54fc1c74059: failed to remove device 5f665fc469da1651fb1161b5bfc8c2b3937de89d2844919626ab39598f09d132:devicemapper: Can't set task name /dev/mapper/docker-253:2-67259921-pool

Comment 6 Frantisek Kluknavsky 2017-07-04 14:47:10 UTC
*** Bug 1456344 has been marked as a duplicate of this bug. ***

Comment 8 Luwen Su 2017-07-22 14:59:36 UTC
The fresh install is fine in docker-1.12.6-48.git0fdc778.el7.x86_64.rpm

Comment 10 errata-xmlrpc 2017-08-02 00:11:21 UTC
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://access.redhat.com/errata/RHBA-2017:2344