Bug 1468250

Summary: Docker %pre RPM scriplet fails if there are no Docker containers running
Product: Red Hat Enterprise Linux 7 Reporter: Tadej Janež <tadej.j>
Component: dockerAssignee: Jindrich Novy <jnovy>
Status: CLOSED WONTFIX QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: amurdaca, carl, dwalsh, lsm5, tsweeney
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: 2020-06-09 21:27:31 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
Patch to fix the %pre RPM scriptlet to not fail if there are no Docker containers running none

Description Tadej Janež 2017-07-06 13:05:40 UTC
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 10:03:58 UTC
Lokesh not sure what this code is trying to do.

Comment 3 Tadej Janež 2017-07-07 11:42:26 UTC
(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 10:18:59 UTC
Ok Tadej, now I see it.  I misread this yesterday morning. 

LGTM

Comment 5 Carl George 2018-03-15 20:21:01 UTC
That section of the %pre script was removed entirely in docker-1.12.6-48.git0fdc778.el7.

https://git.centos.org/commitdiff/rpms!docker.git/037cc37d0f797ad12e75013bd8e244f1e0023fdb

Comment 6 Tom Sweeney 2020-06-09 21:27:31 UTC
We have no plans to ship another version of Docker at this time. RHEL7 is in final support stages where only security fixes will get released.  Customers should move to use Podman which is available starting in RHEL 7.6.