running skopeo in podman fails with "Error inspecting image"

Bug #1797114 reported by Cédric Jeanneret on 2018-10-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Emilien Macchi

Bug Description

Hello guys,

While deploying an overcloud using podman as container_cli, we hit a situation where `skopeo inspect' doesn't work when launched from within a container, but actually does work when launched from the host.

For example:

It can be reproduced using the quickstart reproducer script located here for example:

If you're using a libvirt node, you can run it like that:
bash -w $(pwd)/work -v true -a -l

Changed in tripleo:
importance: Undecided → Medium
Cédric Jeanneret (cjeanner) wrote :

Fun fact: running "podman exec <running container> skopeo inspect <image>" does actually work....

Cédric Jeanneret (cjeanner) wrote :

More precisions:

Two containers, two different ways to react. One is working as expected, while the second one does NOT.

Skopeo versions are the same:

Failing container:
mistral_engine (

Working container:
mistral_api (

The full error is:
2018-10-10 12:53:48 | Error inspecting image: docker://
2018-10-10 12:53:48 | time="2018-10-10T12:53:46Z" level=fatal msg="error getting username and password: error reading JSON file "/run/containers/42430/auth.json": error unmarshaling JSON at "/run/containers/42430/auth.json": unexpected end of JSON input"

The /run/containers directory does not exist in the working container, while it DOES exist in the failing container.

Main difference: /run is bind-mounted in the failing container, while NOT in the working one.

Question: is the bind-mount requested? :)

Cédric Jeanneret (cjeanner) wrote :

Still digging.

Some other containers have skopeo installed, same version as well:
- mistral_event_engine (
Also has the /run mounted

- nova_scheduler (
Also has the /run mounted

- mistral_executor (
Also has the /run mounted

Small note: the access to /run/container is root-only.

If we run, with any of the listed "failing" container, the following command:
podman exec --user root 1d01350439f7 skopeo inspect docker://

Tadaaa, it works.

So, real error is a "permission denied".

Cédric Jeanneret (cjeanner) wrote :

Still digging, and confirmation:
- running the exact same image with the exact same mounts, SAVE the /run:/run, allows skopeo to work as expected.

I suspect the binary to do some path checking, for instance "is there /run/containers, if so fetch the auth.json thingy", and it fails with an uncatched access error.

Meaning: skopeo/libpod bug.

Bogdan Dobrelya (bogdando) wrote :

Just let's fix mistral thingy that runs skopeo, buildah, podman et al. If we want that looking exactly like when launched from the host, one should use nsenter. I have an example [0] to use.


Cédric Jeanneret (cjeanner) wrote :

So, as per Miloslav comment on the github issue, a way to workaround this issue is to just pass a new env variable to the containers:

-e "XDG_RUNTIME_DIR=/tmp/"

It seems this XDG_RUNTIME_DIR is used in order to create some temporary file for the authentication or something like that. Passing a user writable location is enough to make skopeo inspect work (just tested on my reproducer).

In parallel, the "Permission Denied" error is now correctly caught in - so we will get a better understanding next time we hit this kind of issue :).

Fix proposed to branch: master

Changed in tripleo:
assignee: Emilien Macchi (emilienm) → Steve Baker (steve-stevebaker)
status: Triaged → In Progress
Cédric Jeanneret (cjeanner) wrote :

@Bogdan: you have a fine hammer, but that doesn't mean everything is a nail ;).

Bogdan Dobrelya (bogdando) wrote :

Bind-mounting /run and/or any specific things like /run/containers to make thing appearing like executed on host, *does* look like a nail to me. We should use nsenter to make things working like executed on hosts avoiding "special" bind mounts IMO

Changed in tripleo:
assignee: Steve Baker (steve-stevebaker) → Cédric Jeanneret (cjeanner)
Changed in tripleo:
assignee: Cédric Jeanneret (cjeanner) → Steve Baker (steve-stevebaker)
Changed in tripleo:
assignee: Steve Baker (steve-stevebaker) → Emilien Macchi (emilienm)

Submitter: Zuul
Branch: master

commit 28a5ba0a01383f69b3a8880286830d4c00901fc4
Author: Steve Baker <email address hidden>
Date: Thu Oct 11 17:38:50 2018 +1300

    Replace skopeo inspect with python

    This replaces the skopeo inspect calls with python equivalent. It is
    faster than the skopeo inspect for two reasons:
    - the auth token is shared for all requests
    - the tags list request is made concurrently

    This should also help with running the dry-run prepare in the mistral
    podman container since /run is not involved at all in this

    Change-Id: Ia898d0acfdeac1699e7e08e2935a2a4eaf578531
    Closes-Bug: #1797114

Changed in tripleo:
status: In Progress → Fix Released

This issue was fixed in the openstack/tripleo-common 10.1.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.