Bug 2278652

Summary: container=oci dropped in f40
Product: [Fedora] Fedora Container Images Reporter: Colin Walters <walters>
Component: fedora-container-imageAssignee: Clement Verna <clems.verna>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 40CC: clems.verna, dwalsh, fedoraproject, jlebon
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-08 16:26:17 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:

Description Colin Walters 2024-05-02 15:29:11 UTC
$ skopeo inspect -n docker://quay.io/fedora/fedora:39 | jq .Env
[
  "DISTTAG=f39container",
  "FGC=f39",
  "container=oci"
]
$ skopeo inspect -n docker://quay.io/fedora/fedora:40 | jq .Env
null
$

Also

$ skopeo inspect -n docker://registry.access.redhat.com/ubi9/ubi:latest | jq .Env
[
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "container=oci"
]

Comment 1 Colin Walters 2024-05-02 15:34:30 UTC
Specifically, there's a fair amount of tooling that checks for `container` being set.

Comment 2 Colin Walters 2024-05-02 16:46:43 UTC
I guess this is somewhat bike-sheddable as uptake of that environment variable hasn't been high.

Oh wait...interesting.  There's another wrinkle here, which is I think podman itself will auto-set the variable if it hasn't been set, but other container runtimes (e.g. at least cri-o as used by OCP) doesn't inherit this behavior.  And I think docker never did either.

Well...I guess arguably we could try to change everything to do the stanza of "check /run/.containerenv, check /.dockerenv".  But that's going to take some time to propagate with a pretty wide potential blast radius: https://github.com/search?q=getenv%28%22container%22%29&type=code

Comment 4 Clement Verna 2024-05-08 16:26:17 UTC
This is now fixed

 [cverna@laptop]  $ skopeo inspect -n docker://quay.io/fedora/fedora:rawhide | jq .Env
[
  "container=oci"
]
~
 [cverna@laptop]  $ skopeo inspect -n docker://quay.io/fedora/fedora:40 | jq .Env
[
  "container=oci"
]