idea连接docker实现一键部署的方法(idea docker 调试)

admin 184 2022-07-27

阿里云服务器优惠多,折扣错,惊喜多,请咨询:www.wqiis.com

1.修改docker配置文件,打开2375端口

[root@s162 docker]# vim /usr/lib/systemd/system/docker.service #查找 ExecStart,在末尾添加 #后面加上-H tcp://0.0.0.0:2375 [root@s162 docker]# systemctl daemon-reload [root@s162 docker]# systemctl start docker ## 查看2375端口是否启用 [root@s162 docker]# lsof -i:2375 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dockerd 27021 root 5u IPv6 352598799 0t0 TCP *:2375 (LISTEN)

idea连接docker实现一键部署的方法(idea docker 调试)

2. Idea安装配置docker插件

2.1. idea-plugins市场安装docker插件

略…

2.2. 配置docker

3.springboot项目部署到docker服务器

3.1. 编写docker/dockerfile

3.2.maven添加docker-maven-plugin插件

com.spotify docker-maven-plugin 1.0.0 jhs/${project.artifactId}:${project.version} ${project.basedir}/docker http://192.168.129.162:2375 / ${project.build.directory} ${project.build.finalName}.jar target/${project.build.finalName}.jar

3.3. docker:build

使用命令$ mvn clean package docker:build -Dmaven.test.skip=true构建镜像,在docker服务器上查看镜像是否上传成功:

3.4 docker:tag

docker命令行格式为:#docker tag :/:

插件配置 补充配置:

jhs/${project.artifactId}:${project.version} 192.168.129.160:5000/${project.artifactId}:${project.version}

为镜像打上tag标签,为后续的push做准备:mvn clean docker:tag -Dmaven.test.skip=true -DskipDockerBuild

3.5 docker:push

插件配置 补充配置:

nexus-docker-registry 192.168.129.160:5000 192.168.129.160:5000/${project.artifactId}

将上文打上tag标签的镜像,推送到私服nexus:mvn clean docker:push -Dmaven.test.skip=true -DskipDockerBuild -DskipDockerTag

3.6 docker插件参数

-DskipDockerBuild to skip image build -DskipDockerTag to skip image tag -DskipDockerPush to skip image push -DskipDockerto skip any Docker goals

3.7 绑定命令到maven phases

build-image package build tag-image package tag jhs/${project.artifactId}:${project.version} 192.168.129.160:5000/${project.artifactId}:${project.version} push-image deploy push nexus-docker-registry 192.168.129.160:5000 192.168.129.160:5000/${project.artifactId}

3.8 最佳实践

http://192.168.129.162:2375 192.168.129.160:5000 com.spotify docker-maven-plugin 1.0.0 dic/${project.artifactId}:${project.version} ${project.basedir}/docker ${docker.host} / ${project.build.directory} ${project.build.finalName}.jar target/${project.build.finalName}.jar build-image package build tag-image package tag dic/${project.artifactId}:${project.version} ${docker.registry.url}/${project.artifactId}:${project.version} push-image deploy push nexus-docker-registry ${docker.registry.url} ${docker.registry.url}/${project.artifactId}

4.Docker私服仓库Harbor安装的步骤详解(补充)

https:///article/161964.htm

上一篇:企业对数据库服务器的要求是什么?该服务器的优点有哪些?(适应数据仓库环境的服务器类型是)
下一篇:织梦更新列表页提示Fatal error: Call to a member function Get(织梦栏目添加)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~