...
安装jdk1.8https://blog.csdn.net/woshimeihuo/article/details/90608081
安装docker
1.添加yum源(添加过可跳过这一步)
yum install epel-release –y
yum clean all
yum list
2.安装并运行docker
yum install docker-io –y
systemctl start docker
3.检查结果
docker info
出现以下结果证明安装成功:
将springboot应用打包成jar包,然后制作成镜像在docker中运行
1.将应用打包成jar包,创建Dockerfile文件,将二者放到服务器上同一文件夹下
Dockerfile:
FROM java:8
ADD servicea-0.0.1.jar servicea.jar
EXPOSE 8762
ENTRYPOINT [ "java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/servicea.jar" ]
执行“FROM java:8”这一步时下载速度非常慢,可在/etc/docker/daemon.json文件中添加镜像加速地址如下:
{
"registry-mirrors": ["https://registry.dockercn.com","https://mj9kvemk.mirror.aliyuncs.com"]
}
daemon.json文件的配置可参考:https://blog.csdn.net/u013948858/article/details/79974796
//"hosts":["tcp://0.0.0.0:2375","unix:///var/run/docker.sock"]
//https://www.imooc.com/article/details/id/28426
作者:huifeideyu6