Fabric8 中的 docker-compose 无法正常工作



在集成测试之前,我正试图让docker-maven-plugin在docker容器中运行redisPostgreSQL 11实例。以下是我在pom.xml文件中的设置:

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${docker-maven.version}</version>
<configuration>
<verbose>true</verbose>
<images>
<image>
<alias>docker-dbs</alias>
<external>
<type>compose</type>
<composeFile>docker-compose-test.yml</composeFile>
</external>
<run>
<wait>
<time>5000</time>
<log>Docker databases are ready to accept connections</log>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start-docker-dbs</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-docker-dbs</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>

我正在尝试运行指定的docker-compose-test.yml文件中定义的服务,该文件包含以下内容:

version: "3.8"
alias: docker-dbs
services:
redis:
image: "redis:alpine"
command: redis-server
environment:
- REDIS_REPLICATION_MODE=master
ports:
- "5378:6379"
postgres:
image: "postgres:11"
restart: always
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_DB: topfind-accounts-test-db
ports:
- "4431:5432"

我知道这个文件是正确的,因为我尝试过手动运行它,但我无法在需要时让maven为我运行它。有什么建议吗?

看起来composer文件的3.x版本仍然不受支持。

我遇到了类似的问题,并看到错误消息:Execution start of goal io.fabric8:docker-maven-plugin:0.33.0:stop failed: Only version 2.x of the docker-compose format is supported for src/main/docker/docker-compose.yml

相关内容

  • 没有找到相关文章

最新更新