question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docker Compose service suffix changed from `_1` to `-1`

See original GitHub issue

Hi, I’m not sure when this change happened but it seems one of the latest docker-compose desktop version changed the suffix naming pattern for services from _1 to -1

This let’s my tests fail as the lookup doesn’t work anymore

564eae8ef285   zzsybrtief7r_pdf        "docker-entrypoint.s…"   ...  3000/tcp       zzsybrtief7r-pdf-1
e8ddf410a42c   zzsybrtief7r_dummy      "/docker-entrypoint.…"   ...  80/tcp         zzsybrtief7r-dummy-1

 Caused by:
        org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
            at app//org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
            at app//org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
            ... 106 more

            Caused by:
            org.testcontainers.containers.ContainerLaunchException: Could not create/start container
                at app//org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:525)
                at app//org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
                at app//org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
                ... 107 more

                Caused by:
                org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container zzsybrtief7r_pdf_1 as it is not running
                    at app//org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:815)
                    at app//org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:365)
                    ... 109 more

If I change my exposed service setting to -1 like this:

@Container
    val pdf = DockerComposeContainer(...)
        .withLocalCompose(true)
        .withExposedService("pdf-1", 3000) // change from _1 to -1
        .withBuild(true)

The error gets stranger:

...
ContainerLaunchException: Aborting attempt to link to container jjz1pmny2gn9_pdf-1_1 as it is not running

❯ docker-compose --version Docker Compose version v2.3.3


Docker Desktop Version `4.6.0 (75818)`

OS: MacBook Pro (16", 2021)
M1 Pro

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mxabcommented, Mar 23, 2022

Ok the change to -1 happens when Use Docker Compose V2 is enabled

2reactions
kiviewcommented, Mar 31, 2022

@govardhanaraoganji In Docker Desktop for Windows, this is a setting in their UI. I’d assume there is something similar on Mac.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker-compose image named: "prefix_%s_1" instead of "%s"
According to docker compose issue #745: By default, Compose bases the project name on basename of the directory compose commands are run from....
Read more >
Compose specification - Docker Documentation
A Compose implementation creating resources on a platform MUST prefix resource names by project and set the label com.docker.compose.project . Project name can ......
Read more >
Create a Dev Container - Visual Studio Code
Create a new docker-compose.yml (or make a copy of an existing one) that you use to develop a service. Extend your existing Docker...
Read more >
Advanced network options in Windows | Microsoft Learn
Switch Embedded Teaming with Docker Networks ... already in use on the container host (i.e. a network adapter other than the one being...
Read more >
Docker - Renovate Docs
1 -stretch as that would change the suffix. If this behavior does not suit a particular package you have, Renovate allows you to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found