Bug 1468250 - Docker %pre RPM scriplet fails if there are no Docker containers running
Docker %pre RPM scriplet fails if there are no Docker containers running
Status: ASSIGNED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: docker (Show other bugs)
7.3
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Lokesh Mandvekar
atomic-bugs@redhat.com
: Extras
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-06 09:05 EDT by Tadej Janež
Modified: 2017-07-08 06:18 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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)
Patch to fix the %pre RPM scriptlet to not fail if there are no Docker containers running (747 bytes, patch)
2017-07-06 09:05 EDT, Tadej Janež
no flags Details | Diff

  None (edit)
Description Tadej Janež 2017-07-06 09:05:40 EDT
Created attachment 1294932 [details]
Patch to fix the %pre RPM scriptlet to not fail if there are no Docker containers running

Description of problem:
When upgrading from:
docker.x86_64 2:1.12.6-28.git1398f24.el7
to:
docker.x86_64 2:1.12.6-32.git88a4867.el7
the %pre RPM scriptet failed and yum outputted the following:

Stopping 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

This happened because no containers were running when the %pre RPM scriplet was executed.

Version-Release number of selected component (if applicable):
docker.x86_64 2:1.12.6-32.git88a4867.el7

How reproducible:
Always.

Steps to Reproduce:
1. Install docker.x86_64 2:1.12.6-28.git1398f24.el7
2. Make sure no containers are running (i.e. 'docker ps -q' is empty)
3. Upgrade to docker.x86_64 2:1.12.6-32.git88a4867.el7
Comment 2 Daniel Walsh 2017-07-07 06:03:58 EDT
Lokesh not sure what this code is trying to do.
Comment 3 Tadej Janež 2017-07-07 07:42:26 EDT
(In reply to Daniel Walsh from comment #2)
> Lokesh not sure what this code is trying to do.

Dan,

if you mean my patch, then the important difference compared to the previous command is xargs' --no-run-if-empty argument which means:

"If the standard input does not contain any nonblanks, do not run the command."

This will prevent the error above where 'docker stop' command was called without arguments.
Comment 4 Daniel Walsh 2017-07-08 06:18:59 EDT
Ok Tadej, now I see it.  I misread this yesterday morning. 

LGTM

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