Stream: containers

Topic: Container name inconsistencies cause problems in cpwebapp.sh


view this post on Zulip Balázs Pataki (Oct 27 2025 at 15:53):

When running the dev containers via docker compose or mvn the container names will differ. This causes problems when I want to use the file watcher mechanism to track changes to xhtml-s and to copy them to the container via cpwebapp.sh, which assumes the container is called dev_dataverse. However, when the container is run via mvn the container name will be dataverse-1.

Should we solve the container names, or should we check for either names in cpwebapp.sh?

docker compose -f docker-compose-dev.yml up

> docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Names}}"
CONTAINER ID   IMAGE                                           COMMAND                  NAMES
beb95a3c1d2d   caddy:2-alpine                                  "caddy run -c /Caddy…"   dataverse-develop-dev_proxy-1
4614654d1b01   gdcc/dataverse:unstable                         "/usr/bin/dumb-init …"   dev_dataverse
0b5c5232d941   solr:9.8.0                                      "docker-entrypoint.s…"   dev_solr
edb7e9476909   postgres:17                                     "docker-entrypoint.s…"   dev_postgres
7044e743147b   localstack/localstack:4.2.0                     "docker-entrypoint.sh"   dev_localstack
76dd4250c801   minio/minio                                     "/usr/bin/docker-ent…"   dev_minio
b5636aa4f019   maildev/maildev:2.0.5                           "bin/maildev"            dev_smtp
393d8c10079e   quay.io/keycloak/keycloak:26.3.2                "/opt/keycloak/bin/k…"   dev_keycloak
c2ada61a01ac   trivadis/dataverse-previewers-provider:latest   "/docker-entrypoint.…"   previewers-provider
c5b364b6e237   moby/buildkit:buildx-stable-1                   "buildkitd"              buildx_buildkit_maven0

mvn -Pct docker:run -Dapp.skipDeploy

> docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Names}}"
CONTAINER ID   IMAGE                                           COMMAND                  NAMES
d7fc1dadd3c5   caddy:2-alpine                                  "caddy run -c /Caddy…"   caddy-1
e927ec10f15e   gdcc/dataverse:unstable                         "/usr/bin/dumb-init …"   dataverse-1
c900f4ebc1a5   solr:9.8.0                                      "docker-entrypoint.s…"   solr-1
74429f1d6d33   trivadis/dataverse-deploy-previewers:latest     "./entrypoint.sh dep…"   dataverse-deploy-previewers-1
8b52ebd65611   trivadis/dataverse-previewers-provider:latest   "/docker-entrypoint.…"   dataverse-previewers-provider-1
982bd0b46f49   minio/minio                                     "/usr/bin/docker-ent…"   minio-1
d5bd12b5d4fd   localstack/localstack:4.2.0                     "docker-entrypoint.sh"   localstack-1
e4f714deaf07   quay.io/keycloak/keycloak:26.3.2                "/opt/keycloak/bin/k…"   keycloak-1
54b960639150   maildev/maildev:2.0.5                           "bin/maildev"            maildev-5
51124b94a648   postgres:17                                     "docker-entrypoint.s…"   postgres-1
ec6eb6226341   gdcc/configbaker:unstable                       "/usr/bin/dumb-init …"   configbaker-1
94d745503c49   gdcc/configbaker:unstable                       "/usr/bin/dumb-init …"   dev_bootstrap
bf559db844df   trivadis/dataverse-deploy-previewers:latest     "./entrypoint.sh dep…"   register-previewers
c5b364b6e237   moby/buildkit:buildx-stable-1                   "buildkitd"              buildx_buildkit_maven0

view this post on Zulip Philip Durbin 🚀 (Oct 27 2025 at 15:55):

Consistent naming sounds good to me. @Oliver Bertuch what do you think?

view this post on Zulip Balázs Pataki (Oct 27 2025 at 15:59):

And also @Oliver Bertuch : how to solve it? :slight_smile:

view this post on Zulip Balázs Pataki (Oct 27 2025 at 16:00):

I can work around the names in  cpwebapp.sh but I'd prefer consistent naming as well.

view this post on Zulip Balázs Pataki (Oct 27 2025 at 16:28):

Ok, this maybe easy, just need to add <containerNamePattern>%a</containerNamePattern> to docker-maven-plugin config, sg. like this:

<plugin>
  <groupId>io.fabric8</groupId>
  <artifactId>docker-maven-plugin</artifactId>
  <configuration>
   ...
    <containerNamePattern>%a</containerNamePattern>
  </configuration>
</plugin>

Very intuitive. :slight_smile:

view this post on Zulip Oliver Bertuch (Oct 28 2025 at 08:02):

Hi folks. I'm fine with whatever. It's probably easier to make the Maven Plugin use the same names as compose creates. PRs welcome.

view this post on Zulip Balázs Pataki (Oct 28 2025 at 09:19):

Submitted PRs for both issues:

https://github.com/IQSS/dataverse/pull/11935

https://github.com/IQSS/dataverse/pull/11936

view this post on Zulip Philip Durbin 🚀 (Oct 28 2025 at 11:54):

The fix was to add <containerNamePattern>%a</containerNamePattern>? Weird. :smile:

view this post on Zulip Philip Durbin 🚀 (Oct 28 2025 at 11:56):

"The <alias> of an image which must be set. The alias is set in the top-level image configuration" -- https://fabric8io.github.io/docker-maven-plugin/ 4.2. Container Names

view this post on Zulip Philip Durbin 🚀 (Oct 28 2025 at 11:56):

@Balázs Pataki thanks for the PRs!


Last updated: Oct 30 2025 at 05:14 UTC