compose icon indicating copy to clipboard operation
compose copied to clipboard

parameter to specify runtime to build image

Open t-hofmann opened this issue 5 months ago • 1 comments

Description

Use Case

Build an image with specific runtime (e. g. nvidia-runtime).

Current Situation

Currently if during building an image a specific runtime is required the default runtime must be set to the required runtime (e. g. specify nvidia-runtime as default runtime in /etc/docker/daemon.json).

This also has the side effect of changing the runtime of every container, where no explicit runtime is given.

There already exists a runtime directive in the docker-compose.yml, which specifies the runtime to use for container execution (i. e. not for building the image).

Feature

Make it possible to specify the runtime to use for building the image in docker-compose.yml. So that the change of the server configuration is not needed and hence the mentioned side effect does not occur.

In other words: enable users to build with a specific runtime-requirement without changing the server's default-runtime in daemon.json.

Alternatives

  • use the runtime specified by the runtime directive in docker-compose.yml also for the build-phase
  • introduce a new directive runtime below the build diretive in docker-compose.yml

The latter seems to have minimal changes to the API.

t-hofmann avatar Jul 13 '25 16:07 t-hofmann

If such a feature exists on Bake (github.com/docker/buildx) we would add support for it. AFAICT build process doesn't ket you select a container runtime but offers platform abstraction to achieve a comparable purpose

ndeloof avatar Jul 15 '25 06:07 ndeloof

Closing as "not planned" - compose only can expose features supported by the builder.

ndeloof avatar Dec 16 '25 08:12 ndeloof