docker 启动jar包
1、编写Dockerfile文件
FROM openjdk:8 ENV TZ="Asia/Shanghai" ADD cim-gisportal.jar cim-gisportal.jar ADD nohup.out nohup.out ENTRYPOINT ["nohup","java","-jar","/cim-gisportal.jar","> nohup.out &"] EXPOSE 18204
2、镜像打包
docker build -t cim-gisportal .
3、镜像启动
docker run -d -p 18204:18204 --restart=always -e JAVA_OPTS='-Duser.timezone=GMT+08' -v /etc/localtime:/etc/localtime:ro --name cim-gisportal cim-gisportal
4、常用命令
docker logs cim-gisportal 查看日志
docker exec -it cim-gisportal sh 进入容器
docker stop cim-gisportal 停止容器
docker start cim-gisportal 启动容器
docker rm cim-gisportal 删除容器
docker rmi cim-gisportal 删除镜像
5、容器日志删除
cd /var/lib/docker/containers/