FluentDocker icon indicating copy to clipboard operation
FluentDocker copied to clipboard

Container Names with Underscores

Open cord-agencyroot opened this issue 3 years ago • 1 comments

Not sure if this is actually said anywhere, but I was having a terrible time trying to get the wait to properly work with docker-compose.

None of the 'wait' lambda breakpoints where being hit, here is an example:

  compositeBuilder.Wait("postgres_projectname", (service, _) =>
        {
            service.WaitForMessageInLogs("listening on IPv4 address", 30000L);
            return 0;
        });

Placing a breakpoint inside the lambda would never stop at the "WaitForMessageInLogs" line.

  postgres_projectname:
    container_name: postgres_projectname
    environment:
      POSTGRES_USER: postgressql
      POSTGRES_PASSWORD: postgressql
      POSTGRES_DB: postgressql
    image: postgres:14-alpine
    ports:
      - "5432:5432"

Turns out it was because I had _ (underscore) character for my container names, seems like it causes FluentDocker to ignore the wait (or doesn't find a match) when building.

Change my container name to 'postgres-projectname' seemed to fix the issue

Not sure if this is a bug or working as intended, but it would be nice to get some sort of notification/warning with using _ as a name. Hopefully this helps someone if they come across the same issue.

Note: This may be more of a docker limitation than an issue with FluentDocker, but hopefully this helps someone

cord-agencyroot avatar Aug 09 '22 13:08 cord-agencyroot

Hi @cord-agencyroot, thanks for the bug report and the workaround!

mariotoffia avatar Aug 22 '22 06:08 mariotoffia