• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

bibryam/docker-maven-plugin: Maven plugin for Docker

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

bibryam/docker-maven-plugin

开源软件地址(OpenSource Url):

https://github.com/bibryam/docker-maven-plugin

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Maven plugin for Docker

This plugin allows managing multiple Docker containers from a maven build process.

###Prerequisites Locally running docker with TCP sockets enabled: On RHEL thats in /usr/lib/systemd/system/docker.service

ExecStart=/usr/bin/docker -d -H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock

###Usage The start goal will create a container instance from an image and start it. If the image is not available locally, the plugin will pull the image from the internet.

The stop goal will stop the container instances and remove them from the local registry. The image will remain on the local repository.

If containers are not stopped explicitly using stop goal, the plugin by default will try to stop and delete all containers started from start goal. If you want to keep containers running after maven build has finished, use skipStop option to prevent stopping the containers.

containerConfig option allows configuring container creation parameters. hostConfig option allows configuring container start parameters.

###Examples Here is the simplest example to start a container from publicly available "busybox" image and stop it at the end of the build:

<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>

Next is a complete example with all the possible configurations:

<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>



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap