docker部署jar项目,推送到Dockerhub

2年前 (2022) 程序员胖胖胖虎阿
194 0 0

1,编写Dockerfile

FROM java:8
MAINTAINER kason <你的邮箱@88.com>
ADD admin-api-0.0.1-SNAPSHOT.jar test.jar

EXPOSE 7001

ENTRYPOINT ["java","-jar","test.jar"]

2,生成镜像

docker build -t bl-play-api-admin-test:1.0.0 .

3,运行镜像,生成容器

docker run -d -p 7001:7001 bl-play-api-admin-test:1.0.0

可以正常访问:
docker部署jar项目,推送到Dockerhub

4,登录dockerhub

docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: wx**88
Password:
Login Succeeded

Logging in with your password grants your terminal complete access to your account.
For better security, log in with a limited-privilege personal access token. Learn more at https://docs.docker.com/go/access-tokens/

5,给镜像打tag

docker tag w****8/bl-play-api-admin-test:1.0.0 w****8/bl-api-api-admin-test:1.0.0

docker部署jar项目,推送到Dockerhub

6,推送打过tag的镜像

docker push w****8/bl-api-api-admin-test:1.0.0

7,推送成功

docker部署jar项目,推送到Dockerhub

8,修改文件后重新成成镜像并推送

docker build -t bl-play-api-admin-test:1.0.1 .

docker tag bl-play-api-admin-test:1.0.1 w****8/bl-api-api-admin-test:1.0.1

docker push w****8/bl-api-api-admin-test:1.0.1

9,推送成功

docker部署jar项目,推送到Dockerhub

10,如何部署静态文件

可以参考:https://amosannn.github.io/20...

版权声明:程序员胖胖胖虎阿 发表于 2022年10月4日 上午3:08。
转载请注明:docker部署jar项目,推送到Dockerhub | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...