0、步骤
systemctl daemon-reload
systemctl restart docker
1、步骤
mkdir /root/mgt-dir
cd /root/mgt-dir
vim run.sh
java -jar /data/jeecg-boot-mgt-2.3.0.jar
vim Dockerfile
# 基础镜像使用java
FROM java:8
EXPOSE 10001
ENTRYPOINT ["sh","/data/run.sh"]
上传jeecg-boot-mgt-2.3.0.jar包,到/root/mgt-dir/下
# 查询docker进程
docker ps
docker ps -a
# 停止容器
docker stop $(docker ps -a | grep mgt)
# 移除容器
docker rm -f $(docker ps -a | grep mgt)
# 查看镜像
docker images
# 删除字符串包含boot的镜像
docker rmi --force $(docker images | grep mgt)
# 创建镜像
docker build -t mgt-image .
# 运行镜像并挂载(mgt-img一定要放到后面)
# --restart=always (docker引擎重启后自动运行(也可以理解为操作系统重启后自动运行,如果docker是开机自动运行的话))
docker run -d -it --name=mgt -p 10001:8088 -v /root/mgt-dir/:/data mgt-image /bin/bash
# 查看docker mgt日志
docker logs -f --tail 10 mgt
# 进入容器
docker exec -it 'mgt' /bin/bash
# 进入data目录
cd data/
# 查看文件
ls
Dockerfile jeecg-boot-mgt-2.3.0.jar run.sh
# 退出容器
exit
3、nginx配置
server {
listen 80;
listen 443 ssl;
server_name 47.93.11.11 xxx.xxxxxxxxxx;
#ssl_certificate 7647358_xxx.xxxxxxxxxx.com.pem;
#ssl_certificate_key 7647358_xxx.xxxxxxxxxx.com.key;
#ssl_protocols TLSv1.1 TLSv1.2;
#ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
#ssl_prefer_server_ciphers on;
#ssl_session_cache shared:SSL:10m;
#ssl_session_timeout 10m;
#client_max_body_size 5000m;
error_page 405 =200 http://$host$request_uri;
access_log /www/server/panel/vhost/nginx/log/access.log;
sendfile on;
client_max_body_size 5000m;
client_body_buffer_size 1000m;
keepalive_timeout 600;
send_timeout 600;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Data-Type,X-Requested-With,X-Data-Type,X-Auth-Token';
if ( $request_method = 'OPTIONS' ) {
return 200;
}
location = / {
proxy_pass http://127.0.0.1;
}
location /mgt {
proxy_pass http://127.0.0.1:10001/ym-mgt/; #proxy_pass后加/,干掉/mgt
}
location / {
#root /root/;
try_files $uri $uri/ /index.html;
index index.html;
autoindex on;
}
}
标签:jar,ssl,proxy,timeout,mgt,docker,包到
From: https://www.cnblogs.com/kikyoqiang/p/17344157.html