Bug 1793084

Summary: "podman play kube" generates wrong UserCommand when creating pod, defaults to /bin/bash
Product: Red Hat Enterprise Linux 8 Reporter: Robb Manes <rmanes>
Component: podmanAssignee: Jindrich Novy <jnovy>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: bbaude, ddarrah, dornelas, dwalsh, jligon, jnovy, lsm5, mheon, mschibli, weshen, ypu
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: podman-1.6.4-2.module+el8.1.1+5363+bf8ff1af podman-1.6.4-5.module+el8.2.0+5795+9bd98c8c Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 15:52:11 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:
Bug Depends On:    
Bug Blocks: 1186913, 1734579    

Description Robb Manes 2020-01-20 16:07:37 UTC
Description of problem:
When using `podman play kube <YAML FILE>` in RHEL8 (or, subsequently, RHEL7), the "command" directive is ignored, and instead defaults to /bin/bash.

Using this example for a YAML file:

version: v1
kind: Pod
metadata:
  name: sleep-pod
spec:
  containers:
  - command: ["/usr/bin/sleep", "5"]
    image: ubi8/ubi
    name: sleep-container
status: {}


When we play the pod, we do not get '/usr/bin/sleep' as the CMD, but rather /bin/bash:

# podman play kube pod.yaml 
Pod:
f2835d9b9a3aa9e02aea68b99d337d12391de4351830fe9ff9cf938492cdd3da
Container:
2867ab7738d4173ec4d60ffe4e5205e264b3fc4ecf98cbf0d3414c51b90b75d6

# podman pod ps
POD ID         NAME        STATUS    CREATED         # OF CONTAINERS   INFRA ID
f2835d9b9a3a   sleep-pod   Running   3 minutes ago   1                 9ce7bbce16bf

# podman ps -a
CONTAINER ID  IMAGE                                COMMAND               CREATED        STATUS                    PORTS  NAMES
2867ab7738d4  registry.access.redhat.com/ubi8/ubi  /bin/bash             9 seconds ago  Exited (0) 8 seconds ago         sleep-container

This appears to be fixed by this commit:

https://github.com/containers/libpod/commit/fb9e1d7d9f332e513d392c7b8ccf1093807bb1a0

commit fb9e1d7d9f332e513d392c7b8ccf1093807bb1a0
Author: Chen Zhiwei <zhiweik>
Date:   Wed Aug 14 07:13:24 2019 +0000

    Fix play kube command in pod yaml
    
    Signed-off-by: Chen Zhiwei <zhiweik>

If we use the next branch this is included in, the problem is resolved; I compiled 1.5.1 (compiling on the exact commit causes execution errors due to another bug):

$ git tag --contains=fb9e1d7d9f332e513d392c7b8ccf1093807bb1a0
v1.5.1
v1.6.0
v1.6.0-rc1
v1.6.0-rc2
v1.6.1
v1.6.1-rc1
v1.6.2
v1.6.2-rc1
v1.6.3
v1.6.4
v1.7.0
v1.7.0-rc1
v1.7.0-rc2

Opening this BZ to ensure this makes it into the next release from upstream as a backport.


Version-Release number of selected component (if applicable):
podman-1.4.2-6.module+el8.1.0+4830+f49150d7.x86_64

How reproducible:
Every time

Steps to Reproduce:
Steps are provided above with YAML file.

Actual results:
Command from `podman play kube` is always /bin/bash instead of actual container command

Expected results:
Command should always be specified container command.

Comment 13 errata-xmlrpc 2020-04-28 15:52:11 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/RHSA-2020:1650