[root@iZwz9535z41cmgcpkm7i81Z idea]# pwd
/home/idea
[root@iZwz9535z41cmgcpkm7i81Z idea]# ls
[root@iZwz9535z41cmgcpkm7i81Z idea]# ls
Dockerfile testdocker-1.0.0.jar
[root@iZwz9535z41cmgcpkm7i81Z idea]# docker build -t shan666 .
[root@iZwz9535z41cmgcpkm7i81Z idea]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
shan666 latest 3de56aa20b0a 6 seconds ago 660MB
nginx latest 605c77e624dd 3 months ago 141MB
tomcat 9.0 b8e65a4d736d 4 months ago 680MB
centos latest 5d0da3dc9764 7 months ago 231MB
redis 5.0.9-alpine3.11 3661c84ee9d0 2 years ago 29.8MB
java 8 d23bdf5b1b1b 5 years ago 643MB
[root@iZwz9535z41cmgcpkm7i81Z idea]# docker run -d -P --name shan-springboot-web shan666
84d2498a5eec5bcd3f60c915f8cf5d5fa5b8e5dfab1c179c30b3efc4ec68052e
[root@iZwz9535z41cmgcpkm7i81Z idea]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
84d2498a5eec shan666 "java -jar /app.jar …" 5 seconds ago Up 3 seconds 0.0.0.0:49160->8080/tcp shan-springboot-web
[root@iZwz9535z41cmgcpkm7i81Z idea]# curl localhost:49160/
{"timestamp":"2022-04-28T03:16:51.901+00:00","status":404,"error":"Not Found","message":"","path":"/"}[root@iZwz9535z41cmgcpkm7i81Z idea]# curl localhost:49160/hello
hello,shan[root@iZwz9535z41cmgcpkm7i81Z idea]#