GOOGLE JIB

GOOGLE新推出的java maven容器构建,这里写一下我的使用过程

官方github: https://github.com/GoogleContainerTools/jib.git

 

1.准备一个自己的docker 私服,我的私服服务器地址是:192.168.232.101

1.1 安装docker服务,并启动

yum install docker -y  

systemctl enable docker  

systemctl start docker 

我这边删除了/etc/sysconfig/docker的insecure

1.2 安装registry

docker pull registry:latest

 

docker run -d -p 5000:5000 --restart=always \

-v /opt/registry-var/:/var/lib/registry/ \

registry:latest

 

在/etc/sysconfig/docker文件中添加一下配置:

ADD_REGISTRY='--insecure-registry 192.168.232.101:5000'  

systemctl restart docker 

 

2.JAVA工程设置

 

<build>
		<plugins>
			
			<plugin>
				<groupId>com.google.cloud.tools</groupId>
				<artifactId>jib-maven-plugin</artifactId>
				<version>0.9.4</version>
				<configuration>
					<from>
						<image>hub.c.163.com/chengyingqi/centos-jdk:latest</image>
						<!--<credHelper>None</credHelper>-->
					</from>
					<!--<to>-->
						<!--<image>hub.c.163.com/chengyingqi/oauth:latest</image>-->
						<!--<credHelper>pass</credHelper>-->
					<!--</to>-->
					<to>
						<image>192.168.232.101:5000/chengyingqi/oauth:1.0</image>
					</to>
					<allowInsecureRegistries>true</allowInsecureRegistries>
				</configuration>
			</plugin>
		</plugins>
	</build>

这里拉取了一个我自己的jdk镜像,并推送到刚刚的docker私服

执行mvn compile

mvn jib:build

 

3.私服查看

[root@localhost ~]# curl -XGET http://192.168.232.101:5000/v2/_catalog
{"repositories":["chengyingqi/oauth"]}
[root@localhost ~]# curl -XGET http://192.168.232.101:5000/v2/chengyingqi/oauth/tags/list
{"name":"chengyingqi/oauth","tags":["1.0"]}
[root@localhost ~]# 

4.从另外一台服务器拉取

[root@localhost chengyingqi]# echo '{ "insecure-registries":["192.168.232.101:5000"] }' > /etc/docker/daemon.json
[root@localhost zsg]# docker pull 192.168.232.101:5000/chengyingqi/oauth:1.0Trying to pull repository 192.168.232.101:5000/chengyingqi/oauth ... 
Get https://192.168.232.101:5000/v1/_ping: http: server gave HTTP response to HTTPS client
[root@localhost chengyingqi]# systemctl restart docker
[root@localhost chengyingqi]# docker pull 192.168.232.101:5000/chengyingqi/oauth:1.0
Trying to pull repository 192.168.232.101:5000/chengyingqi/oauth ... 
1.0: Pulling from 192.168.232.101:5000/chengyingqi/oauth
a3ed95caeb02: Pull complete 
86cd131a32e8: Pull complete 
25faacc49e05: Pull complete 
5e35d10a3eba: Pull complete 
ee5c8e5870ad: Pull complete 
f74e450a7752: Pull complete 
2adecf746b69: Pull complete 
Digest: sha256:a5ce41180f978fa46c6e151f82c21d64b2bff73ea68110b9f9bc593c6269f498
Status: Downloaded newer image for 192.168.232.101:5000/chengyingqi/oauth:1.0

 

 

OK ~谢谢

转载于:https://my.oschina.net/u/3666671/blog/1845065

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值