Docker Maven Plugin 介绍
docker maven plugin
是个简单的可以管理Docker容器maven插件,这个插件将会根据你的配置,在构建时启动容器,构建结束时停止容器并删除,如果本地找不到镜像,Docker会自动去中央仓库下载。
简单示例:
<plugin> <groupId>com.ofbizian</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.0.0</version> <configuration> <images> <image> <name>busybox</name> </image> </images> </configuration> <executions> <execution> <id>start-docker</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> </executions> </plugin>
所有可能配置的完整示例:
<plugin> <groupId>com.ofbizian</groupId> <artifactId>docker-maven-plugin</artifactId> <version>1.0.0</version> <configuration> <dockerUrl>http://localhost:4243</dockerUrl> <images> <image> <name>dockerfile/redis</name> <containerConfig> <![CDATA[ {"Hostname":"", "PortSpecs":null, "User":"", "Tty":false, "OpenStdin":false, "StdinOnce":false, "Memory":0, "MemorySwap":0, "CpuShares":0, "AttachStdin":false, "AttachStdout":false, "AttachStderr":false, "Env":null, "Cmd":null, "Dns":null, "Volumes":null, "VolumesFrom":"", "Entrypoint":[ ], "NetworkDisabled":false, "Privileged":false, "WorkingDir":"", "Domainname":"", "ExposedPorts":null, "OnBuild":null} ]]> </containerConfig> <hostConfig> <![CDATA[ {"ContainerIDFile": null, "LxcConf": null, "Links": null, "PortBindings": { "6379/tcp": [ { "HostIp": "0.0.0.0", "HostPort": "6379" } ] }, "Privileged": false, "PublishAllPorts": false} ]]> </hostConfig> </image> <image> <name>busybox</name> </image> </images> </configuration> <executions> <execution> <id>start-docker</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-docker</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> </plugin>
Docker Maven Plugin 官网
https://github.com/bibryam/docker-maven-plugin
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。