Docker Maven Plugin 管理 Docker 容器开源项目

我要开发同款
匿名用户2014年04月03日
39阅读
开发技术Java
所属分类云计算、PaaS系统/容器
授权协议MIT

作品详情

dockermavenplugin是个简单的可以管理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>https://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>
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论