1、下载jdk镜像
docker pull jdk1.8
2、制作dockerfile
[root@dbserver b]# cat dockerfile
FROM jdk1.8:v131
MAINTAINER XAPJ
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
ADD eureka-v1.jar eureka-v1.jar
ADD auth-v1.jar auth-v1.jar
ADD uaa-v1.jar uaa-v1.jar
ADD gateway-v1.jar gateway-v1.jar
ADD start.sh /start.sh
RUN chmod +x /start.sh
ENTRYPOINT ["sh","-c","/start.sh"]
3、编写start.sh脚本
[root@dbserver b]# cat start.sh
#!/bin/bash
nohup java -jar eureka-v1.jar --server.port=8080 &
sleep 60
nohup java -jar auth-v1.jar --server.port=8888 &
sleep 60
nohup java -jar uaa-v1.jar --server.port=8089 &
sleep 60
nohup java -jar gateway-v1.jar --server.port=8188 &
while [[ true ]]; do
sleep 1
done
4、 创建docker镜像
docker build -t login-server:v1 .