Bug 1833390

Summary: Podman does not respect configuration in "/etc/containers/registries.conf.d"
Product: Red Hat Enterprise Linux 8 Reporter: Simon Krenger <skrenger>
Component: podmanAssignee: Valentin Rothberg <vrothber>
Status: CLOSED ERRATA QA Contact: atomic-bugs <atomic-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: bbaude, dornelas, dwalsh, jligon, jnovy, jortizpa, lfriedma, lsm5, mheon, moddi, santiago, tsweeney, umohnani, vrothber, ypu
Target Milestone: rcKeywords: Extras
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: podman-1.9.0 and newer Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-21 15:32:03 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:
Bug Depends On:    
Bug Blocks: 1186913, 1793607    

Description Simon Krenger 2020-05-08 15:01:28 UTC
Description of problem:

In Red Hat OpenShift Container Platform, additional registry configuration (for example "unqualified-search-registries") for "/etc/containers/registries.conf" is stored in files in "/etc/containers/registries.conf.d/". This is described in RHBZ#1802213 for example.

`crictl` and the `crio` runtime do respect the configuration stored in "/etc/containers/registries.conf.d/", but `podman` does not, which can be very confusing and is inconsistent.

Version-Release number of selected component (if applicable):

```
sh-4.4# podman --version
podman version 1.6.4
sh-4.4# rpm-ostree status
State: idle
AutomaticUpdates: disabled
Deployments:
* pivot://quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:4cd521fb34c0d362205a1e55ad8c9c8dd6c7365b71a357ef705692ed80f7b112
              CustomOrigin: Managed by pivot tool
                   Version: 43.81.202004280317.0 (2020-04-28T03:22:44Z)
```

How reproducible:

Always

Steps to Reproduce:

1. Provision an OpenShift Container Platform Cluster (tested with 4.3.18)

2. Apply the following `MachineConfig` to write the content "unqualified-search-registries = ['quay.io']" to "/etc/containers/registries.conf.d/01-unqualified.conf"

```
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels:
    machineconfiguration.openshift.io/role: worker
  name: 99-worker-unqualified-search-registries
spec:
  config:
    ignition:
      version: 2.2.0
    storage:
      files:
      - contents:
          source: data:text/plain;charset=utf-8;base64,dW5xdWFsaWZpZWQtc2VhcmNoLXJlZ2lzdHJpZXMgPSBbJ3F1YXkuaW8nXQo=
        filesystem: root
        mode: 420
        path: /etc/containers/registries.conf.d/01-unqualified.conf
```

2. Use `oc debug node/worker-0.example.com` and `chroot /host` to use a worker nodes binaries.

3. Use `crictl pull simonkrenger/echoenv` to pull an image that does not exist on 'quay.io', verify that it fails, as "unqualified-search-registries" was set to 'quay.io' above.

4. Use `podman pull simonkrenger/echoenv`

Actual results:

Podman does not read the configuration from "/etc/containers/registries.conf.d/01-unqualified.conf" and proceeds to pull from "docker.io". 

Expected results:

Podman reads the configuration from "/etc/containers/registries.conf.d" and pulls from the configured registry.

Additional info:

Comment 2 Tom Sweeney 2020-05-08 17:50:25 UTC
I think Valentin Rothberg fixed this sometime in the Podman v1.8 time frame.  Valentin can you confirm?

Comment 3 Daniel Walsh 2020-05-08 19:01:56 UTC
From a little detective work, it looks like the first podman version with this is podman 1.9.0
Which means to get it you will need to mode to RHEL8.2.1 which will be the next release.

Comment 4 Derrick Ornelas 2020-05-13 21:16:57 UTC
I think this bug belongs under RHEL 8, especially since RHCOS is referenced.

Comment 8 Laurie Friedman 2020-05-14 07:18:05 UTC
Setting exception+ as agreed by Kerri Anderson before 8.2.1 code freeze since podman is approved for 8.2.1 and all 8.2.1 BZs require exception+

Comment 11 Urvashi Mohnani 2020-05-21 18:03:41 UTC
*** Bug 1802213 has been marked as a duplicate of this bug. ***

Comment 12 Joy Pu 2020-05-28 13:45:14 UTC
Test with podman-1.9.3-1.module+el8.2.1+6750+e53a300c.x86_64. Comments out all items in register.conf and add file /etc/containers/registries.conf.d/01-unqualified.conf as described in the bug. Try to pull simonkrenger/echoenv but failed as expect. So set this to verified.
more details: 
# podman pull simonkrenger/echoenv
Trying to pull quay.io/simonkrenger/echoenv...
  Get https://quay.io/v2/: dial tcp 10.11.5.40:443: connect: connection refused
Error: error pulling image "simonkrenger/echoenv": unable to pull simonkrenger/echoenv: 1 error occurred:
	* Error initializing source docker://quay.io/simonkrenger/echoenv:latest: error pinging docker registry quay.io: Get https://quay.io/v2/: dial tcp 10.11.5.40:443: connect: connection refused
# podman info
...
registries:
  search:
  - quay.io
...

Comment 14 errata-xmlrpc 2020-07-21 15:32:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:3053