maven构建docker镜像push到镜像仓库

registry私人镜像仓库:

docker pull hub.c.163.com/library/registry:latest

Docker tag imageid registry

docker run -d -p 5000:5000 -v /Users/zhongxing/docker/registry/opt:/var/lib/registry registry

pom.xml: 



	4.0.0

	base-eureka
	jar

	base-eureka
	Demo project for Spring Boot

	
		com.zxing
		base-ms
		1.0-SNAPSHOT
	

	
		192.168.20.200:5000
		true
	

	

		
			net.logstash.logback
			logstash-logback-encoder
			4.10
		

		
			org.springframework.cloud
			spring-cloud-starter-netflix-eureka-server
		

	

	
		
			
				src/main/resources
			
			
				${env}
				true
			
		
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
			
				com.spotify
				docker-maven-plugin
				0.4.13
				
					${docker.registry}/${project.groupId}/${project.artifactId}:${project.version}
					${basedir}/src/main/docker
					${push.image}
					
						
							${project.build.directory}
							${project.build.finalName}.jar
						
					
				
			
		
	



Dockerfile:

FROM java:8
ADD base-eureka-1.0-SNAPSHOT.jar app.jar
CMD ["java","-jar","app.jar"]

mac 配置insecure registries: (docker push fail。。。)

maven构建docker镜像push到镜像仓库_第1张图片

maven运行:

docker:build

打包结果:

maven构建docker镜像push到镜像仓库_第2张图片

运行:

docker run -d -p 8761:8761 --name=eureka 192.168.20.200:5000/com.zxing/base-eureka:1.0-SNAPSHOT

https://blog.csdn.net/boling_cavalry/article/details/78872020

你可能感兴趣的:(Spring,Boot,Docker,Mac)