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
可以正常访问:
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
6,推送打过tag的镜像
docker push w****8/bl-api-api-admin-test:1.0.0
7,推送成功
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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。