-
Couldn't load subscription status.
- Fork 22
Description
See quick fix solution PR [#125 ]
Due to the container_name in the docker-compose.yml for the service cli not being dynamic (or absent which infers it being dynamic automatically), if i run two two of the same govcms projects with the same name, I get a naming conflict.
Preferred solution: use additional_contexts to container depending locally on each other.
@see https://docs.docker.com/compose/how-tos/dependent-images/#use-another-services-image-as-the-base-image
Quick fix solution (this PR):
-> Remove container_name (so its dynamic)
-> Set image name to be dynamic so other dependancies so the new image name built. (not preferred because docker compose build --pull breaks.
Fixes regression caused by: #91
Workaround in docker.compose.yml:
(make sure to replace MYPROJECT with your project name).
# This value intentionally matches the project name on Lagoon.
# It is used to name the CLI_IMAGE to use as a build arg locally.
x-lagoon-project: &lagoon-project
${COMPOSE_PROJECT_NAME:-MYPROJECT}
services:
cli:
# Set new name for image name, and override in images below, as govcms does
# not use additional_contexts, so our created image matches in dependant
# docker images.
# https://docs.docker.com/compose/how-tos/dependent-images/#use-another-services-image-as-the-base-image
# Also we can't use `--pull` in `docker compose build --no-cache --pull`,
# for dependant images as the docker file does not know it's built locally,
# so it fails pull and so cancels the opteration fails completely.
# https://github.com/moby/moby/issues/46280#issuecomment-1686762697
image: *lagoon-project
# Reset value to null, so we can have multiple different docker containers
# without name conflict.
# @see https://github.com/compose-spec/compose-spec/pull/340
container_name: !reset
test:
build:
args:
CLI_IMAGE: *lagoon-project
nginx:
build:
args:
CLI_IMAGE: *lagoon-project
php:
build:
args:
CLI_IMAGE: *lagoon-project