fabric8io / docker-maven-plugin

Maven plugin for running and creating Docker images
https://dmp.fabric8.io
Apache License 2.0
1.88k stars 643 forks source link

External Compose and Wait seems not working #1792

Open grrolland opened 5 months ago

grrolland commented 5 months ago

Description

When using external docker compose as :

version: "2.0"
services:
  minio:
    image: quay.io/minio/minio
    restart: always
    environment:
      - MINIO_ROOT_USER=xxxxx
      - MINIO_ROOT_PASSWORD=xxxxx
    ports:
      - 19000:9000
      - 19001:9001
    command: ["server", "/data", "--console-address", ":9001"]
  mc:
    image: quay.io/minio/mc
    depends_on:
      - minio
    volumes:
      - ./files:/data
    links:
      - "minio:minio"
    entrypoint: "/bin/sh /data/init.sh"
  mc-end:
      image: quay.io/minio/mc
      entrypoint: "/bin/sh echo"
      depends_on:
          mc:
              condition: service_completed_successfully

And configuration as :

 <configuration>
    <images>
        <image>
            <alias>test-env</alias>
            <name>test-env</name>
            <external>
                <type>compose</type>
                <basedir>test-env</basedir>
                <composeFile>docker-compose.yml</composeFile>
            </external>
            <run>
                <wait>
                    <time>3600000</time>
                </wait>
            </run>
        </image>
    </images>
    <showLogs>true</showLogs>
</configuration>

Here I expect :

When the init.sh from the mc container run for a long time (more than 10s), I have this error :

DOCKER> I/O Error [[quay.io/minio/mc:latest] "mc": Timeout after 10287 ms while waiting on exit code 0]

The wait configuration seems to ne be applied

Info

FelipeGXavier commented 3 months ago

Same issue here

marcelcamporelli commented 1 month ago

We have the same issue.

In Version 0.40.1, the following works as expected.

In Version 0.45.1, the wait is ignored.

 <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.45.1</version>
        <configuration>
          <showLogs>false</showLogs>
          <containerNamePattern>%a</containerNamePattern>
          <images>
            <image>
              <alias>(our image name)</alias>
              <external>
                <type>compose</type>
                <basedir>.</basedir>
                <composeFile>docker-compose-pg-test.yml</composeFile>
              </external>
              <run>
                <containerNamePattern>%a</containerNamePattern>
                <wait>
                  <time>60000</time>
                </wait>
              </run>
            </image>
          </images>
        </configuration>
        <executions>
          <execution>
            <id>start</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>stop</goal>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>stop</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>