Closed PinkJohnOfUs closed 3 years ago
@haircommander I seem to recall that play kube
builds its container commands differently from the rest of Podman - could that be what's causing this?
if you only set the entry point, then it only uses the entry point for the command. https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes
hm but neither are set in the yaml, which means we're not correctly getting the command from the image
@PinkJohnOfUs Any chance you can try with the Podman 2.2.0 RC? We did a rewrite of the play kube
backend that may have resolved the issue.
@mheon the bug appeared after rewrite of play kube
I guess, I was testing it with Podman 2.2.0 RC, correct me if I'm wrong (see Output of podman --version
above):
git show
commit 02843f881f9271440e7eaad8db231ddf20e33e51 (HEAD, tag: v2.2.0-rc1)
Author: Matthew Heon <mheon@redhat.com>
Date: Wed Nov 18 13:15:11 2020 -0500
Can't tell you wich commit is causing this bug, but at least it isn't in issue with commit:
916825b6753086d7712ba593e5381b9bd49aae96
I can confirm that this is not working with Podman 2.2.0 RC.
@PinkJohnOfUs Can you confirm that this only appeared after 2.2.0-rc1? Your original bug report was filed against 2.1.1. Does the bug happen with both, or just 2.2.0-rc1?
@mheon I can confirm that this appeared after 2.2.0-rc1, it is not happening with 2.1.1. The output of apt list podman
was maybe misleading, sorry for that.
Also tested it with v2.2.0 and it is still not working.
git show
commit db1d2ff111ee9b012779ff3a5279a982520ccda4 (HEAD, tag: v2.2.0)
Author: Matthew Heon <mheon@redhat.com>
Date: Mon Nov 30 16:29:41 2020 -0500
Bump to v2.2.0
Signed-off-by: Matthew Heon <mheon@redhat.com>
diff --git a/changelog.txt b/changelog.txt
index 326f52718..a54028e1c 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,25 @@
Hi, I am observing the same problem with podman version 2.2+ (up to latest master) on Arch Linux. When I updated, I experienced continuously restarting containers in pods, started from podman play kube
. The continuous restarting was probably because of the new restart policy for pods created in this way. The biggest concern for me was that the containers "crashed" without any error message. When I ran the images manually, I found out they work fine though. I can reliably reproduce the problem with the docker.io/nginx:mainline-alpine
image and the following pod.yaml
:
apiVersion: v1
kind: Pod
metadata:
labels:
app: web
name: web_pod
spec:
restartPolicy: Never
containers:
- name: nginx
image: docker.io/nginx:mainline-alpine
I did a bit of digging and found out that the combination of ENTRYPOINT
and CMD
seems to be the problem as the following Containerfile shows:
FROM docker.io/alpine:latest
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["while true; do cat /etc/os-release; sleep 1; done"]
Note: moving the -c
to the CMD
part doesn't help, but tries to run /bin/sh
as a shell script ?
For me this bug is a show-stopper. I did see the extent of breakage after updating on my server. I am using the play kube
feature as a replacement of docker-compose
since before podman-compose
was a usable alternative for me. Also I wanted to pave the way to Kubernetes.
In light of this, the following line doesn't seem right:
https://github.com/containers/podman/blob/5c6b5ef34905f40562b518799c35be8d06694e65/pkg/specgen/generate/kube/kube.go#L119
Additionally the code doesn't seem to care about imageData.Config.Cmd
.
Should be fixed by #8807
/kind bug
When starting a container with podman play kube that uses /bin/sh as Entry point and a shell script as command, container is behaving unexpected on start. If starting the same script from within the container and not on "Build Time", meaning setting only entrypoint to /bin/sh and starting run.sh by hand without setting cmd in Dockerfile, it is working.
It is not possible to use a shell script as CMD["myshellscript"] in Dockerfile to build a container that starts this script with an kube.yml file with podman play kube.
podman build . --tag bugimage
https://gist.github.com/PinkJohnOfUs/848bfa32186cb562bf853e303ac93649#file-dockerfile https://gist.github.com/PinkJohnOfUs/848bfa32186cb562bf853e303ac93649#file-run-sh
Run the container with play kube:
podman play kube playkube.yml
https://gist.github.com/PinkJohnOfUs/848bfa32186cb562bf853e303ac93649#file-playkube-ymlTake a look into bugreport container logs:
podman logs bash-bug-pod-0-bugcontainer
Result: Logs showing:
I would expect logs showing
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):That is strange expected to be 2.2.0 ??
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?
Tested with release candidate 2.2. on physical device