Skip to content

Container Improvements

Tim Orling yocto-meta-virtualization 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 3 repliesIn review
  2. v17 patches 17 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13image-oci: set OCI_IMAGE_RUNTIME_UID with ??=classes/image-oci.bbclass+2 -10 replies
2/13classes: add container-nonroot-user.bbclassclasses/container-nonroot-user.bbclass+155 -00 replies
3/13classes: add container-volatile-fixup.bbclassclasses/container-volatile-fixup.bbclass+6 -00 replies
4/13classes: add container-dev-mode.bbclassclasses/container-dev-mode.bbclass+34 -00 replies
5/13recipes-containers/images: add app-container-pythonrecipes-containers/images/app-container-python.bb+45 -00 replies
6/13recipes-containers/images: add app-container-mosquittorecipes-containers/images/app-container-mosquitto.bb+43 -00 replies
7/13vcontainer-bbmask.inc: allow 'mosquitto', 'libwebsockets'conf/distro/include/vcontainer-bbmask.inc+2 -20 replies
8/13recipes-containers/images: add app-container-valkeyrecipes-containers/images/app-container-valkey.bb recipes-containers/images/app-container-valkey/container-entrypoint.sh+89 -00 replies
9/13recipes-containers/images: add app-container-nginxconf/layer.conf recipes-containers/images/app-container-nginx.bb+63 -00 replies
10/13vcontainer-bbmask.inc: allow meta-webserver/recipes-httpd/nginxconf/distro/include/vcontainer-bbmask.inc+1 -10 replies
11/13app-container-curl: use multilayer mode; container-nonroot-userrecipes-containers/images/app-container-curl.bb recipes-demo/images/app-container-curl.bb+39 -460 replies
12/13container-image-multiarch: add helper reciperecipes-containers/images/container-image-multiarch.bb+31 -00 replies
13/13vcontainer-tarball: fix buildbot-venv shadowingrecipes-containers/vcontainer/vcontainer-tarball.bb+2 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/13] Container Improvements

This series:
* Sets OCI_IMAGE_RUNTIME_UID with ??= weak assignment in image-oci to allow container-nonroot-user to set a different default
* Adds a class to create/run containers with a non-root user
* Adds a class to create non-volatile var log and tmp directories
* Adds a class to enable 'dev' mode where the container starts as the root user
* Adds new containers:
- app-container-python
- app-containter-mosquitto
- app-container-valkey
- app-container-nginx
* Modifies app-container-curl to be more like the upstream experience (and more like the above containers)
* Allows mosquitto and libwebsockets to be parsed for vcontainer distro so we can build multiarch containers for app-container-mosquitto.
* Allows meta-webserver/recipes-httpd/nginx to be parsed for vcontainer distro so we can build multiarch containers for app-container-nginx.
* Adds a fix for buildbot-venv shadowing for environment-setup-ci script

The resulting containers were tested with simple command line usage compared to Docker provided equivalents to ensure the same expected behavior.

Changes in v2:

There were a fair number of changes in v2 in reponse to review comments and observations during testing.

* image-oci.bbclass:
- set OCI_IMAGE_RUNTIME_UID with ??= to allow other classes to override
* container-nonroot-user.bbclass:
- set EXTRA_USERS_PARAMS with +=
- added comments to clarify the PYEOF Python heredoc behavior
- added logic to detect $image_name/index.json and fail if not found
* container-volatile-fixup.bbclass: avoid repeating the same rootfs postfunc by adding a helper class
* container-dev-mode.bbclass: avoid repeating the same logic to run container as root user in '-dev' mode
* app-container-python (and other container image recipes):
- drop now redundant IMAGE_INSTALL lines
- simplify by inheriting container-volatile-fixup
- inherit container-dev-mode
* app-container-mosquitto:
- verify '-dev' mode switches from root user to mosquitto user
- verify "production" mode runs as 'nonroot' user
- fix bbmask to allow mosquitto and required libwebsockets
* app-container-valkey:
- added tini and container-entrypoint.sh, like upstream containers
* app-container-nginx:
- fixup 'nonroot' user ownership of NONROOT_OWNED_DIRS
- fix bbmask to allow nginx (but not other recipes-httpd)
* fix for older distro hosts where the 'websockets' Python library is not new enough (>10.0) and on the AutoBuilder needs to use 'buildtools'. The PATH in environment-setup-ci now plays properly with such a set up by no longer added /usr/bin and /bin before existing $PATH.

Successful build https://autobuilder.yoctoproject.org/valkyrie/#/builders/117/builds/25

Tim Orling (13):
image-oci: set OCI_IMAGE_RUNTIME_UID with ??=
classes: add container-nonroot-user.bbclass
classes: add container-volatile-fixup.bbclass
classes: add container-dev-mode.bbclass recipes-containers/images: add app-container-python recipes-containers/images: add app-container-mosquitto vcontainer-bbmask.inc: allow 'mosquitto', 'libwebsockets' recipes-containers/images: add app-container-valkey recipes-containers/images: add app-container-nginx vcontainer-bbmask.inc: allow meta-webserver/recipes-httpd/nginx
app-container-curl: use multilayer mode; container-nonroot-user
container-image-multiarch: add helper recipe
vcontainer-tarball: fix buildbot-venv shadowing

 classes/container-dev-mode.bbclass            |  34 ++++
 classes/container-nonroot-user.bbclass        | 155 ++++++++++++++++++
 classes/container-volatile-fixup.bbclass      |   6 +
 classes/image-oci.bbclass                     |   3 +-
 conf/distro/include/vcontainer-bbmask.inc     |   6 +-
 conf/layer.conf                               |   1 +
 .../images/app-container-curl.bb              |  39 +++++
 .../images/app-container-mosquitto.bb         |  43 +++++
 .../images/app-container-nginx.bb             |  62 +++++++
 .../images/app-container-python.bb            |  45 +++++
 .../images/app-container-valkey.bb            |  71 ++++++++
 .../container-entrypoint.sh                   |  18 ++
 .../images/container-image-multiarch.bb       |  31 ++++
 .../vcontainer/vcontainer-tarball.bb          |   4 +-
 recipes-demo/images/app-container-curl.bb     |  46 ------
 15 files changed, 512 insertions(+), 52 deletions(-)
 create mode 100644 classes/container-dev-mode.bbclass
 create mode 100644 classes/container-nonroot-user.bbclass
 create mode 100644 classes/container-volatile-fixup.bbclass
 create mode 100644 recipes-containers/images/app-container-curl.bb
 create mode 100644 recipes-containers/images/app-container-mosquitto.bb
 create mode 100644 recipes-containers/images/app-container-nginx.bb
 create mode 100644 recipes-containers/images/app-container-python.bb
 create mode 100644 recipes-containers/images/app-container-valkey.bb
 create mode 100644 recipes-containers/images/app-container-valkey/container-entrypoint.sh
 create mode 100644 recipes-containers/images/container-image-multiarch.bb
 delete mode 100644 recipes-demo/images/app-container-curl.bb

This series can be found at
https://github.com/moto-timo/meta-virtualization/tree/container-improvements-v2

Signature · 1 line
2.54.0