使用docker-maven-plugin推送镜像到远程docker服务器

1.在pom.xml中配置

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker-maven-plugin.version}</version>
                <configuration>
                    <dockerHost>${dockerHost}</dockerHost>
                    <imageName>${dockerRegistry}/${project.artifactId}:${docker.tag}</imageName>
                    <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>

 

2.为docker服务开通tcp外部访问(开启2375端口)

 

 

3.使用 maven clean package  docker:build  命令进行推送镜像到docker服务器

posted @ 2020-01-02 16:59  panchanggui  阅读(2304)  评论(0编辑  收藏  举报