Red Hat Bugzilla – Bug 1468250
Docker %pre RPM scriplet fails if there are no Docker containers running
Last modified: 2018-03-15 16:21:01 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:
the %pre RPM scriptet failed and yum outputted the following:
\"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):
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
Lokesh not sure what this code is trying to do.
(In reply to Daniel Walsh from comment #2)
> Lokesh not sure what this code is trying to do.
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.
Ok Tadej, now I see it. I misread this yesterday morning.
That section of the %pre script was removed entirely in docker-1.12.6-48.git0fdc778.el7.