You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, users can utilize mirror container registries by configuring the Docker daemon. However, equivalent functionality is lacking for the Buildah backend, limiting flexibility and efficiency in registry management.
Solution (if you have one)
Support for mirrors in werf should be done on two levels: when interacting with the container registry via API, and for the build backend directly at build time.
In the case of the Docker backend, the configuration is not werf's responsibility and the user needs to configure mirrors and restart the daemon him/herself. With Buildah the story is different — it is fully compiled into werf and all its configuration is created by werf in the process.
To solve the issue we suggest adding support for --container-registry-mirror option and using it when initializing API and Buildah backend.
// init registry mirrors if docker cli initialized in context
ifdocker.IsEnabled() &&docker.IsContext(ctx) {
info, err:=docker.Info(ctx)
iferr!=nil {
returnnil, fmt.Errorf("unable to get docker system info: %w", err)
}
ifinfo.RegistryConfig!=nil {
mirrors=info.RegistryConfig.Mirrors
}
}
api.mirrors=&mirrors
}
return*api.mirrors, nil
}
For the Docker backend, you need to add validation and an error with an instruction if the specified mirrors are missing. In case of the Buildah backend, mirrors are simply added as is.
Initializing Buildah backend
When initializing the backend, you need to add mirrors to the configuration (documentation and an example are available in the Buildah repository).
Before proceeding
Problem
Currently, users can utilize mirror container registries by configuring the Docker daemon. However, equivalent functionality is lacking for the Buildah backend, limiting flexibility and efficiency in registry management.
Solution (if you have one)
Support for mirrors in werf should be done on two levels: when interacting with the container registry via API, and for the build backend directly at build time.
In the case of the Docker backend, the configuration is not werf's responsibility and the user needs to configure mirrors and restart the daemon him/herself. With Buildah the story is different — it is fully compiled into werf and all its configuration is created by werf in the process.
To solve the issue we suggest adding support for
--container-registry-mirror
option and using it when initializing API and Buildah backend.Initializing API
The current support in the API is as follows:
werf/pkg/docker_registry/generic_api.go
Lines 125 to 148 in b2a6022
For the Docker backend, you need to add validation and an error with an instruction if the specified mirrors are missing. In case of the Buildah backend, mirrors are simply added as is.
Initializing Buildah backend
When initializing the backend, you need to add mirrors to the configuration (documentation and an example are available in the Buildah repository).
werf/pkg/buildah/native_linux.go
Lines 114 to 117 in 00ee0e1
Additional information
No response
The text was updated successfully, but these errors were encountered: