docker production environment deployment jar package command

docker deployment jar package command

1. Start / close / restart docker process:
systemctl start/stop/restart docker
2.1 into the root directory of the container:
sudo docker exec -it smart_restaurant \
2.2 restart jar package into the container:
sudo docker exec -it smart_restaurant \
java -jar app.jar
3. Check the docker container console log:
docker logs -f -t --since="2020-01-08" --tail=200 smart_restaurant
-f/--follow         跟踪实时日志
-t/--timestamps     显示时间戳(由于java日志有时间戳,最好不加'-t')
--since             开始时间
--tail              最后200行日志
smart_restaurant    容器名称(应用名)
The Dockerfile, jar packaged mirror image:
sudo docker build -t smart_restaurant(镜像名) .
5. Remove the mirror image:
docker rmi -f smart_restaurant(镜像名/ID)
-f                  运行容器时强制删除镜像
6. Remove the container:
docker rm -f smart_restaurant(容器名/ID)
-f                  停止并删除
-v                  删除挂载卷
-l                  删除容器连接,但保留容器
7. Create and run the container:
docker run -p 8016:8016 --name smart_restaurant(容器名) -d smart_restaurant(镜像名)
-p                  端口映射内:外
-d                  后台运行
--name              容器名
8. The startup / shutdown / restart of the container:
docker start/stop/restart smart_restaurant(容器名/ID)   
9. clean-up mirror (not recommended):
docker image prune   
-a                  所有没有使用的镜像
-f                  强制删除,无需提示  

Guess you like

Origin www.cnblogs.com/qinggg/p/12175336.html