Closed Saini01Basu closed 3 years ago
Have also tried -
podman run --privileged --rm -t --mount type=image,source=pas-goat-appsec:jenkins,destination=/opt/pas-goat-appsec:jenkins,rw=true -v /var/lib/jenkins/.local/share/containers/:/var/lib/containers/ harbor.****.com/*********/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.****.com/ --user ************** --password *************** --project PKS --details pas-goat-appsec:jenkins'
On running above i got following error :
Error: Could not get runtime: database libpod temporary files directory (tmpdir) "/run/user/436/libpod/tmp" does not match our libpod temporary files directory (tmpdir) "/var/run/libpod": database configuration mismatch
Also did a run without mounting image volume and directly giving image repository path -
podman run --privileged --rm -t -v /var/lib/jenkins/.local/share/containers/:/var/lib/containers/ harbor.****.com/*********/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.****.com/ --user **************** --password ***************** --project PKS --details --podman-path podman harbor.****.com/pasgoat/pas-goat-appsec:jenkins'
Got the same error as above: Error: Could not get runtime: database libpod temporary files directory (tmpdir) "/run/user/436/libpod/tmp" does not match our libpod temporary files directory (tmpdir) "/var/run/libpod": database configuration mismatch
Thanks for reaching out!
The problem is that /var/lib/jenkins/.local/share/containers/storage/overlay-images/0bfbbb5fe1dba30662287087ac0af3093020d521e50a1e6afedc8d54c306b4b0
is not a valid image reference. The source of an image mount is not meant to be a path on the host but a reference to an image as, for instance, in podman run $image
.
It should work when use the name or ID of the image.
@vrothberg I have tried with image name as well - https://github.com/containers/podman/issues/10397#issuecomment-843803366 Got a different error : Error: Could not get runtime: database libpod temporary files directory (tmpdir) "/run/user/436/libpod/tmp" does not match our libpod temporary files directory (tmpdir) "/var/run/libpod": database configuration mismatch
Got a different error : Error: Could not get runtime: database libpod temporary files directory (tmpdir) "/run/user/436/libpod/tmp" does not match our libpod temporary files directory (tmpdir) "/var/run/libpod": database configuration mismatch
That looks like the tmpdir of root and rootless were mixed. Do other commands work (e.g., podman run --rm busybox ls
)? I assume you're running as a rootless user. Can you have a look at ~/.config/containers/storage.conf
and see if there's something changing the tmpdir?
@vrothberg
The container that I am running has both docker and podman installed in it as of now, the host where I am running the container has only podman installed. Is this causing the issue? Yes m running the container as a rootless user on the host
Docker and Podman can live happily side-by-side on the same machine.
Can you check the questions below?
Do other commands work (e.g., podman run --rm busybox ls)? I assume you're running as a rootless user. Can you have a look at ~/.config/containers/storage.conf and see if there's something changing the tmpdir?
13:06:39 + podman run --rm busybox ls
13:06:39 Completed short name "busybox" with unqualified-search registries (origin: /etc/containers/registries.conf)
13:06:39 Trying to pull container-registry.oracle.com/busybox:latest...
13:06:41 unable to retrieve auth token: invalid username/password: unauthorized: authentication required
13:06:41 Trying to pull docker.io/library/busybox:latest...
13:09:18 toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
13:09:18 Trying to pull registry.fedoraproject.org/busybox:latest...
13:09:18 manifest unknown: manifest unknown
13:09:18 Trying to pull quay.io/busybox:latest...
13:09:18 StatusCode: 404, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final/...
13:09:18 Trying to pull registry.centos.org/busybox:latest...
13:09:18 Get "https://registry.centos.org/v2/": x509: certificate signed by unknown authority
13:09:18 Error: 5 errors occurred while pulling:
13:09:18 * Error initializing source docker://container-registry.oracle.com/busybox:latest: unable to retrieve auth token: invalid username/password: unauthorized: authentication required
13:09:18 * Error determining manifest MIME type for docker://busybox:latest: Error reading manifest sha256:f3cfc9d0dbf931d3db4685ec659b7ac68e2a578219da4aae65427886e649b06b in docker.io/library/busybox: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
13:09:18 * Error initializing source docker://registry.fedoraproject.org/busybox:latest: Error reading manifest latest in registry.fedoraproject.org/busybox: manifest unknown: manifest unknown
13:09:18 * Error initializing source docker://quay.io/busybox:latest: Error reading manifest latest in quay.io/busybox: StatusCode: 404, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final/...
13:09:18 * Error initializing source docker://registry.centos.org/busybox:latest: error pinging docker registry registry.centos.org: Get "https://registry.centos.org/v2/": x509: certificate signed by unknown authority
When I tried to look into storage.conf very weirdly i get - cat: /var/lib/jenkins/.config/containers/storage.conf: No such file or directory
However podman build, podman pull and even podman run for example -
podman run --rm -t -v ${WORKSPACE}:/var/lib/jenkins/workspace/Jenkins-Pasgoat-Pipeline -w /var/lib/jenkins/workspace/Jenkins-Pasgoat-Pipeline harbor.****.com/*********/scan-automation:ee6898aa /bin/bash -c 'dastctl $AppScanSERVER $USERNAME $PASSWORD $FIID'
work as expected
Looks like you hit the Docker Hub rate limit: can you try with podman run --rm fedora ls
?
podman run --rm fedora ls
This worked -
13:21:59 + podman run --rm fedora ls
13:21:59 Completed short name "fedora" with unqualified-search registries (origin: /etc/containers/registries.conf)
13:21:59 Trying to pull container-registry.oracle.com/fedora:latest...
13:22:02 unable to retrieve auth token: invalid username/password: unauthorized: authentication required
13:22:02 Trying to pull docker.io/library/fedora:latest...
13:24:23 toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit
13:24:23 Trying to pull registry.fedoraproject.org/fedora:latest...
13:24:23 Getting image source signatures
13:24:23 Copying blob sha256:7679c09af3851a1622782c74864351c296a0d1886813862fd7116383aeba9f07
13:24:23 Copying config sha256:3567369c671193f96f057f76e3e136ecbd3fdc7065019cc3dd6ed5a96894f128
13:24:23 Writing manifest to image destination
13:24:23 Storing signatures
13:24:23 bin
13:24:23 boot
13:24:23 dev
13:24:23 etc
13:24:23 home
13:24:23 lib
13:24:23 lib64
13:24:23 lost+found
13:24:23 media
13:24:23 mnt
13:24:23 opt
13:24:23 proc
13:24:23 root
13:24:23 run
13:24:23 sbin
13:24:23 srv
13:24:23 sys
13:24:23 tmp
13:24:23 usr
13:24:23 var
Could you try podman system reset
? Note that this will remove all Podman data and set it back to defaults.
If you notice m trying mount a volume as well in the command like -
-v /var/lib/jenkins/.local/share/containers/:/var/lib/containers/
database configuration mismatch may be between the host and the inside the container that m running. m running script inside the container if u notice that starts with twistcli that uses podman
podman system reset
didn't help still get same issue
Also after doing a podman system reset
in jenkins pipeline m getting error for all podman commands - Error: error creating tmpdir: mkdir /run/user/436: permission denied
:(
Ah, you're running podman inside another container? There are a lot of requirements to get that running.
Are you running inside a privileged container?
@rhatdan PTAL
podman run --privileged --rm -t -v /var/lib/jenkins/.local/share/containers/:/var/lib/containers/ harbor.^^^^.com/*/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.****.com/ --user **** --password ***** --project PKS --details --podman-path podman harbor.^^^^.com/pasgoat/pas-goat-appsec:jenkins'
I have highlighted options in above command which is relevant to this issue
Don't do the system reset, it must be attempting to remove and recreate the /run/user/436 directory which a non root user would not be allowed to do.
It looks to me like everything is working. RUnning podman system reset within a privileged container si going to attempt to remove the images/containers that are shared into the container and the running container itself.
podman run --privileged --rm -t -v /var/lib/jenkins/.local/share/containers/:/var/lib/containers/ harbor.^^^^.com/*/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.****.com/ --user **** --password ***** --project PKS --details --podman-path podman harbor.^^^^.com/pasgoat/pas-goat-appsec:jenkins'
I have highlighted options in above command which is relevant to this issue
I was getting the following error :
Error: Could not get runtime: database libpod temporary files directory (tmpdir) "/run/user/436/libpod/tmp" does not match our libpod temporary files directory (tmpdir) "/var/run/libpod": database configuration mismatch
So i was able to fix podman commands post the podman system reset just restarted the jenkins service. Can you guys give me the list of requirements for running podman inside container rootless mode? @rhatdan @vrothberg
It's like i want to be able to do podman pull <
Was able to make it work with below command -
podman run --privileged --rm -t --volume=/var/lib/jenkins/.local/share/containers/storage:/var/lib/containers/storage harbor.^^^^^.com/*/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.^^^^^.com/ --user ***** --password *** --project PKS --containerized --details --output-file results.json harbor.^^^^^.com/pasgoat/pas-goat-appsec:jenkins && cat results.json | jq -rC ".[]"'
The highlighted options in the command did the trick. Anyway Thanks guys
No.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Steps to reproduce the issue:
podman run --rm -t --mount type=image,source=/var/lib/jenkins/.local/share/containers/storage/overlay-images/0bfbbb5fe1dba30662287087ac0af3093020d521e50a1e6afedc8d54c306b4b0,destination=/opt/pas-goat-appsec,rw=true --image-volume=ignore harbor..com/****/scan-automation:ee6898aa /bin/bash -c 'twistcli images scan --address https://containersecurity.****.com/ --user --password --project PKS --details --podman-path podman pas-goat-appsec'
The container i am running using image - harbor..com/****/scan-automation:ee6898aa has podman installed in it
twistcli images scan just need the image within the above container to start the scan hence trying mount image volume
Describe the results you received:
Additional information you deem important (e.g. issue happens only occasionally):
**Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
): podman-3.1.0-1.fc34.x86_64.rpmOutput error :
Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? Tested with podman-3.1.0-1.fc34.x86_64.rpm
Additional environment details (AWS, VirtualBox, physical, etc.): Jenkins pipeline (Oracle Linux Server 8.3)