1. Dockerfile文件如下:
# 环境 FROM centos # 作者信息 MAINTAINER david "3111901846@qq.com" # 复制JDK环境 COPY jdk1.8.0_202 jdk1.8.0_202 # 配置环境变量 ENV JAVA_HOME=./jdk1.8.0_202 ENV PATH=$JAVA_HOME/bin:$PATH ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # 拷贝jar COPY warningmonitor-0.0.1-SNAPSHOT.jar . ADD warningmonitor-0.0.1-SNAPSHOT.jar app.jar COPY application.yml . # 爆漏的端口号 EXPOSE 80 # 执行命令 ENTRYPOINT ["java","-jar","/app.jar","--spring.profiles.active=application.yml"]
2. 执行Dockerfile指令,后面有个点
docker build -t rtcce_patrol:1.0 .
3. 其他常用docker指令
docker run -d -p 80:80 rtcce_nginx:1.0 docker cp sxdw e9ef://usr/share/nginx/html docker commit e9ef rtcce_nginx:1.0 docker save -o rtcce_nginx.tar rtcce_nginx:1.0 docker build -t rtcce_patrol:1.0 . docker exec -it 0f2d /bin/bash systemctl stop firewalld docker run -d -v /SDXL/conf/application-pro.properties:/config/application-pro.properties -p 80:80 docker run -d -v /SDXL/conf/application-pro.properties:/config/application-pro.properties -p 80:80 rtcce_patrol:1.0