Podman oci .containerenv: not a directory - containers

I recently swithed back to podman and got a error with my containers.
Containerfile:
FROM scratch
ADD ./run /
ENTRYPOINT ["/run"]
My applications are all static build go microservices:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w -extldflags "-static"' -o ${BINARY_NAME} *.go
Everything is managed from a Makefile.
Under docker everything worked great, but with podman i get this error.
Error: OCI runtime error: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/run/containers/storage/overlay-containers/5709a135a4f1537fea1fdf8a5750534bc0f782671f115e73201569495024e4fc/userdata/.containerenv" to rootfs at "/run/.containerenv" caused: mount through procfd: open o_path procfd: open /var/lib/containers/storage/overlay/cc55a7c625e1483cc644660c8161db8a4a4a8b9c1120d132f07593834fda1a2c/merged/run/.containerenv: not a directory
My run command is
podman run -d localhost/test:1.0.0
OS information: Ubuntu 21.04
Kernel: 5.11.0-22-generic
Podman: 3.0.1
When i use another container like alpine, it works great under podman.

Just to be sure, do not name the executables, like standard linux directories.
Thanks to Erik Sjölund

Related

Why does container work in Docker but no in GKE

I have a Containerfile installing a go binary[1].
When I build & execute the container via docker run on my Desktop it works fine.
When I however deploy the same container on a GKE pod I get an error:
/bin/sh: /root/service: not found
I would assume that this is a type of security lockdown - but not sure how to get it working on GKE.
[1]:
FROM golang:1.19-alpine AS build
RUN go install github.com/QubitProducts/exporter_exporter#v0.4.5
FROM alpine
COPY --from=build --chown=root:root /go/bin/exporter_exporter /root/service
CMD /root/service
This is because of the volume permission issues for your container. When you are running your container in docker the docker daemon will have access to the root and running your container won’t throw any error since the daemon is already having root access. In kubernetes, pods and containers won’t be having root access by default so when building an image for kubernetes you need to mention the required config maps for mounting root volumes and for executing your code on root volumes.

How can I run buildah inside rootless podman container?

I have tried to add fuse device to container, but it failed.
/] podman run -it --rm --device /dev/fuse --cap-add=SYS_PTRACE -v /search:/search centos8-test
/]# buildah build-using-dockerfile /search/kirbyzhou/sgbuild_Dockerfile/centos8-base
kernel does not support overlay fs: 'overlay' is not supported over <unknown> at "/var/lib/containers/storage/overlay": backing file system is unsupported for this graph driver
ERRO exit status 125
It seems some special rights should be taken.
There is an issue opened on this right now. I am not sure if this is possible. Seems to be fighting against the User Namespace.
Of course you can just run podman build or buildah natively.
Lets continue to discuss this in the issue.

Command to use with scratch docker container

I'm trying to start a docker container for mysql. The image for the container was built from scratch for a training I attended and I need to figure out how to configure it to run a command that will start the container.
The /bin/bash and /bin/sh commands don't work. When I docker inspect the container the CMD section doesn't contain anything. I've tried running CMD['/bin/bash'] or CMD['/bin/sh'] at the end of my docker container run command and that populates the CMD field but the container still won't run.
There are a number of other microservice containers I'm having the same problem with. This is the first one I need to solve however.
This is the command I'm running:
docker run -d -v infytel-mysql-volume:/var/lib/mysql --network=infytel-docker-networkMS --name=infytel-mysql-con2 -e MYSQL_PASSWORD_ROOT=root infytel-mysql-img:v1 /bin/bash
This is my error:
oci runtime error: container_linux.go:235: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory
[EDIT] Running docker logs gives the error shown above.
Running without the /bin/sh command states error response from daemon: No command specified

Permission issue with Podman

I have installed Podman on Ubuntu 18.04 and it seemed to install without issue but...
When I type podman--version I get:
podman version 1.3.0-dev
But if I then type podman ps I get:
Error: could not get runtime: cannot make directory /home/redacted/.config/containers: mkdir /home/redacted/.config/containers: permission denied
I'm not sure why this is happening.
Podman when running rootless attempts to create content in the home directory. In this case it looks like the homedir is /home/redacted.
The user running podman is not allowed to write to the homedir /home/redacted.

Installing gogs persistent on minishift

I'm trying to install gogs on minishift with persistentVolumes.
I did this:
c:\> oc login -u system -p admin
c:\> oc new-project cicd
c:\> oc create -f https://raw.githubusercontent.com/OpenShiftDemos/gogs-openshift-docker/master/openshift/gogs-persistent-template.yaml
from the webconsole I load and execute the imported yaml template and I have gogs and postgresql up and running as you can see in the image below
Unfortunately, when I try to do this first installation of gogs I stuck in this error:
I know the issue is that gogs docker can access in write mode on /etc/gogs/conf/ dir.
How can I solve this on minishift?
thx
fabrizio