docker-moby, container-registry: fix check-config and registry defaults
cover docker-moby, container-registry: fix check-config and registry defaults
Hi all,
This series fixes two problems that are in master and master-next. I found them while building Docker, Podman and containerd hosts for qemuarm64 with the wrynose branch, which has the same code.
The first drops the check-config patch for MEMCG_SWAP. Its hunk no longer lands on the MEMCG_SWAP check, and the installed /usr/share/docker/check-config.sh stops with a syntax error after the optional features.
The second makes CONTAINER_REGISTRY_SECURE = "1" sufficient to select a TLS registry, as the header of container-registry.conf says. Today the fragment leaves CONTAINER_REGISTRY_INSECURE at "1", and parsing stops with "CONTAINER_REGISTRY_SECURE and CONTAINER_REGISTRY_INSECURE cannot both be set to '1'".
Tested on master-next with OE-core master, and on the wrynose branch, with a qemuarm64 Docker host that sets CONTAINER_REGISTRY_SECURE = "1" and leaves CONTAINER_REGISTRY_INSECURE unset: parsing succeeds, docker pull works over HTTPS against the CA installed in /etc/docker/certs.d, and check-config.sh runs to the end, through its network, storage and limits sections.
Thanks,
John
John Madieu (2):
docker-moby: drop the check-config patch for MEMCG_SWAP
container-registry: default to insecure only without a secure registry
conf/distro/include/container-registry.conf | 2 +- recipes-containers/docker/docker-moby_git.bb | 1 - ...g-make-CONFIG_MEMCG_SWAP-conditional.patch | 55 ------------------- 3 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 recipes-containers/docker/files/0001-check-config-make-CONFIG_MEMCG_SWAP-conditional.patch
base-commit: 89b00d096a432000766729cd721ae647af500112
Signature · 1 line
2.25.1
PATCH 1/2 docker-moby: drop the check-config patch for MEMCG_SWAP
check-config.sh of docker-v29 only checks MEMCG_SWAP on kernels older than 5.8, so the patch that skipped that check on 6.1+ kernels has nothing left to do.
When the patch was refreshed for docker-v29.0.0-rc.1, its hunk moved onto the CGROUP_PIDS check, where it opens an if in one { } block and closes it with fi in the next. The installed check-config.sh stops with a syntax error after the optional features, before the network and storage driver checks.
Drop the patch.
--- recipes-containers/docker/docker-moby_git.bb | 1 - ...g-make-CONFIG_MEMCG_SWAP-conditional.patch | 55 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 recipes-containers/docker/files/0001-check-config-make-CONFIG_MEMCG_SWAP-conditional.patch
recipes-containers/docker/docker-moby_git.bb +0 -1
@@ -53,7 +53,6 @@ SRC_URI = "\ file://docker.init \ file://0001-cli-use-external-GO111MODULE-and-cross-compiler.patch \ file://0001-dynbinary-use-go-cross-compiler.patch;patchdir=src/import \ - file://0001-check-config-make-CONFIG_MEMCG_SWAP-conditional.patch;patchdir=src/import \ " DOCKER_COMMIT = "${SRCREV_moby}"
recipes-containers/docker/files/0001-check-config-make-CONFIG_MEMCG_SWAP-conditional.patch deleted +0 -55
55 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [meta-virtualization][PATCH 1/2] docker-moby: drop the check-config patch for MEMCG_SWAP
merged
Bruce
Quoted 19 lines
check-config.shof docker-v29 only checksMEMCG_SWAPon kernels older than 5.8, so the patch that skipped that check on 6.1+ kernels has nothing left to do.When the patch was refreshed for docker-v29.0.0-rc.1, its hunk moved onto the
CGROUP_PIDScheck, where it opens an if in one { } block and closes it with fi in the next. The installedcheck-config.shstops with a syntax error after the optional features, before the network and storage driver checks.Drop the patch.
Signed-off-by John Madieu <[email protected]>--- recipes-containers/docker/docker-moby_git.bb | 1 - ...g-make-CONFIG_MEMCG_SWAP-conditional.patch | 55 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 recipes-containers/docker/files/0001-check-config-make-CONFIG_MEMCG_SWAP-conditional.patch
PATCH 2/2 container-registry: default to insecure only without a secure registry
In reply to John Madieucontainer-registry.conf sets CONTAINER_REGISTRY_INSECURE ?= "1" and its header says to override CONTAINER_REGISTRY_SECURE = "1" for a TLS registry. Doing just that leaves both variables at 1, and parsing stops with "CONTAINER_REGISTRY_SECURE and CONTAINER_REGISTRY_INSECURE cannot both be set to '1'", so CONTAINER_REGISTRY_INSECURE = "0" has to be set as well.
Derive the default of CONTAINER_REGISTRY_INSECURE from CONTAINER_REGISTRY_SECURE, so that the documented override is enough. An explicit CONTAINER_REGISTRY_INSECURE still wins.
--- conf/distro/include/container-registry.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
conf/distro/include/container-registry.conf +1 -1
@@ -24,6 +24,6 @@ CONTAINER_REGISTRY_URL ?= "localhost:5000" CONTAINER_REGISTRY_NAMESPACE ?= "yocto" -CONTAINER_REGISTRY_INSECURE ?= "1" +CONTAINER_REGISTRY_INSECURE ?= "${@'0' if d.getVar('CONTAINER_REGISTRY_SECURE') == '1' else '1'}" IMAGE_FEATURES:append = " container-registry"
Signature · 1 line
2.25.1
Re: [meta-virtualization][PATCH 2/2] container-registry: default to insecure only without a secure registry
Quoted 6 lines
container-registry.conf sets
CONTAINER_REGISTRY_INSECURE?= "1" and its header says to overrideCONTAINER_REGISTRY_SECURE= "1" for a TLS registry. Doing just that leaves both variables at 1, and parsing stops with "CONTAINER_REGISTRY_SECUREandCONTAINER_REGISTRY_INSECUREcannot both be set to '1'", soCONTAINER_REGISTRY_INSECURE= "0" has to be set as well.
Thanks for finding this, but I fixed it a different way. What was wrong is the advice in the fragment header and in build-profiles.md:
container-registry.conf is the insecure registry, so turning secure on on top of it really is turning on both, and the error is right.
Quoted 3 lines
Derive the default of
CONTAINER_REGISTRY_INSECUREfromCONTAINER_REGISTRY_SECURE, so that the documented override is enough. An explicitCONTAINER_REGISTRY_INSECUREstill wins.
I'd rather not key one default off the other. Instead there's now a container-registry-secure.conf fragment, so a TLS registry is just:
require conf/distro/include/container-registry-secure.conf
The insecure fragment and the docs point at it, and including both fragments is still an error, with a message that says to pick one. It's on master as "conf/distro: add a secure container registry fragment" .. let me know if that works for your qemuarm64 setup.
Bruce
Re: [meta-virtualization][PATCH 2/2] container-registry: default to insecure only without a secure registry
Hi Bruce,
Thanks for your feedback.
Quoted 5 lines
The insecure fragment and the docs point at it, and including both fragments is still an error, with a message that says to pick one. It's on master as "conf/distro: add a secure container registry fragment" .. let me know if that works for your qemuarm64 setup.
The secure fragment works for my qemuarm64 setup. With 8f20dd54 on top of OE-core master, a Docker host that only requires container-registry-secure.conf builds, gets the registry CA in /etc/docker/certs.d/<registry>/, and pulls over HTTPS from the generated registry. Requiring both fragments stops at parse time with the new message.
Quoted 3 lines
Bruce
Regards,
John