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)
2. Idea安装配置docker插件
2.1. idea-plugins市场安装docker插件
略…
2.2. 配置docker
3.springboot项目部署到docker服务器
3.1. 编写docker/dockerfile
3.2.maven添加docker-maven-plugin插件
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<!--指定生成的镜像名,如果不指定tag,默认会使用latest-->
<imageName>jhs/${project.artifactId}:${project.version}</imageName>
<!--添加额外的指定标签, 非必须-->
<!--
<imageTags>
<imageTag>${project.version}</imageTag>
</imageTags>
-->
<!-- 指定 Dockerfile 路径 :项目根路径下-->
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<!--指定远程 docker api地址-->
<dockerHost>http://192.168.129.162:2375</dockerHost>
<!-- copy资源 -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<!--docker build dockerfile时:设置镜像创建时的变量 -->
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
3.3. docker:build
使用命令$ mvn clean package docker:build -Dmaven.test.skip=true构建镜像,在docker服务器上查看镜像是否上传成功:
3.4 docker:tag
docker命令行格式为:
#docker tag <imageId or imageName> <nexus-hostname>:<repository-port>/<image>:<tag>
插件配置
<configuration>补充配置:
<configuration>
<image>jhs/${project.artifactId}:${project.version}</image>
<!-- docker tag 打标签-->
<newName>192.168.129.160:5000/${project.artifactId}:${project.version}</newName>
</configuration>
为镜像打上tag标签,为后续的push做准备:mvn clean docker:tag -Dmaven.test.skip=true -DskipDockerBuild
3.5 docker:push
插件配置
<configuration>补充配置:
<configuration>
<!-- docker push 推送到远程镜像仓库-->
<!-- serverId: 为在maven setting.xml配置的server信息id-->
<serverId>nexus-docker-registry</serverId>
<registryUrl>192.168.129.160:5000</registryUrl>
<!-- 打上tag的新镜像 push 到nexus-->
<imageName>192.168.129.160:5000/${project.artifactId}</imageName>
</configuration>
将上文打上tag标签的镜像,推送到私服nexus:mvn clean docker:push -Dmaven.test.skip=true -DskipDockerBuild -DskipDockerTag
3.6 docker插件参数
-DskipDockerBuildto skip image build-DskipDockerTagto skip image tag-DskipDockerPushto skip image push-DskipDockerto skip any Docker goals
3.7 绑定命令到maven phases
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>jhs/${project.artifactId}:${project.version}</image>
<newName>192.168.129.160:5000/${project.artifactId}:${project.version}</newName>
</configuration>
</execution>
<execution>
<id>push-image</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<!-- docker push 推送到远程镜像仓库-->
<!-- serverId: 为在maven setting.xml配置的server信息id-->
<serverId>nexus-docker-registry</serverId>
<registryUrl>192.168.129.160:5000</registryUrl>
<imageName>192.168.129.160:5000/${project.artifactId}</imageName>
</configuration>
</execution>
</executions>
3.8 最佳实践
<properties>
<docker.host>http://192.168.129.162:2375</docker.host>
<docker.registry.url>192.168.129.160:5000</docker.registry.url>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<imageName>dic/${project.artifactId}:${project.version}</imageName>
<!--添加额外的指定标签(可配置多个), 若果没做指定,则为latest-->
<!--
<imageTags>
<imageTag>${project.version}</imageTag>
</imageTags>
-->
<!-- 指定 Dockerfile 路径 :项目根路径下-->
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<!--指定远程 docker api地址-->
<dockerHost>${docker.host}</dockerHost>
<!-- copy资源 -->
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<!--docker build dockerfile时:设置镜像创建时的变量 -->
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>dic/${project.artifactId}:${project.version}</image>
<newName>${docker.registry.url}/${project.artifactId}:${project.version}</newName>
</configuration>
</execution>
<execution>
<id>push-image</id>
<phase>deploy</phase>
<goals>
<goal>push</goal>
</goals>
<configuration>
<!-- docker push 推送到远程镜像仓库-->
<!-- serverId: 为在maven setting.xml配置的server信息id-->
<serverId>nexus-docker-registry</serverId>
<registryUrl>${docker.registry.url}</registryUrl>
<imageName>${docker.registry.url}/${project.artifactId}</imageName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
4.Docker私服仓库Harbor安装的步骤详解(补充)
https://www.jb51.net/article/161964.htm
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。




