-
Couldn't load subscription status.
- Fork 22
Description
In the old version docker, containers are built sequentially, so cli image is built before other containers.
But in the new docker engine with BuildKit as of version 23.0, containers are built in parallel and the depends_on key no longer affects build time order, only runtime (so starts containers in a certain order only).
So we this error on fresh build.
docker compose build --no-cache
target test: failed to solve: smartraveller-dev: failed to resolve source metadata for docker.io/library/[project_name]:latest: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed.
The fix is the is using the new additional_contexts key as mentioned in the documentation. There is also a guide provided.
Fix:
I have raised a PR to fix this: #128 or if GovCMS want overridden dynamic image name for cli, they can use this #130
Interim Workarounds with without fix:
Option 1:
Build image sequentially (takes longer).
DOCKER_BUILDKIT=0 docker compose build --no-cache
Option 2: not recommended
Build cli container first only, then the rest of the containers. (note sometimes when the error happens, the parallel build manages to build cli before crashing, so you may not see the error if you retry )(not recommended since, future updates will need a rebuild twice! as new non-cli containers will be built from old cli container while new cli container is built)
docker compose build cli --no-cache
docker compose build --no-cache
Option 3:
Edit/create a docker-compose.override.yml file with addtional_contexts to ensure order. (until fixed in govcms/upstream).
Note to replace myproject with your GovCMS project name.
x-additional-context-cli: &additional-context-cli
- myproject=service:cli
services:
test:
build:
additional_contexts:
*additional-context-cli
nginx:
build:
additional_contexts:
*additional-context-cli
php:
build:
additional_contexts:
*additional-context-cli