1.修改linux服务器docker配置文件
vim /usr/lib/systemd/system/docker.service
添加配置
ExecStart=/usr/bin/dockerd
-H fd:// --containerd=/run/containerd/containerd.sock
-H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
重启docker
systemctl daemon-reload
systemctl restart docker
2.Idea下载docker插件
3.修改项目pom文件
org.springframework.boot spring-boot-maven-plugin 2.4.1 true true com.Main8090 repackage com.spotify docker-maven-plugin 1.0.0 build-image package build idea2021test latest ${project.basedir} http://101.200.201.196:2375 / ${project.build.directory} ${project.build.finalName}.jar
4.打包、build
---> Running in 0ff0ece2e746
Removing intermediate container 0ff0ece2e746
---> 76846947b2eb
Step 4/4 : ENTRYPOINT ["java","-jar","/app.jar"]
---> Running in fac72c653afd
Removing intermediate container fac72c653afd
---> f7866a998d4e
ProgressMessage{id=null, status=null, stream=null, error=null, progress=null, progressDetail=null}
Successfully built f7866a998d4e
Successfully tagged idea2021test:latest
[INFO] Built idea2021test
[INFO] Tagging idea2021test with latest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:43 min
[INFO] Finished at: 2021-06-17T21:02:25+08:00
表示build成功
5.创建容器
6.配置映射端口
7.运行
到此这篇关于Idea配置Docker 远程部署的文章就介绍到这了,更多相关idea部署远程docker内容请搜索IT博客社区以前的文章或继续浏览下面的相关文章希望大家以后多多支持IT博客社区!
没有更多内容。