springboot连接docker、部署项目

1、先卸载旧版本docker,然后安装docker最新的版本

sudo yum remove docker  docker-common docker-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce 
systemctl start docker

2、暴露端口给springboot项目

vim /usr/lib/systemd/system/docker.service

3、重启docker

systemctl daemon-reload
systemctl restart docker

4、项目配置


					docker-registry
					http://119.3.87.239:23198
					

						registry.cn-hangzhou.aliyuncs.com/y9net/${project.name}:${project.version}
					${project.basedir}/src/main/docker
					false
					
						
							/
							${project.build.directory}
							${project.build.finalName}.jar
						
					
				

springboot连接docker、部署项目_第1张图片
代码块

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD iclaim-policy-1.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
EXPOSE 28099
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

在这里插入图片描述

你可能感兴趣的:(springboot连接docker、部署项目)