第一步:编译打包本地的文件
package
第二步:执行docker bulid打包命令
docker build -t sunyuhua/algo-ability:1.0.0 .
sunyuhua@sunyuhua-HKF-WXX:~/workspace/shbgit/algo-ability$ docker build -t sunyuhua/algo-ability:1.0.0 .
[+] Building 141.3s (7/7) FINISHED docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 515B 0.0s
=> [internal] load metadata for docker.io/library/openjdk:17-alpine 1.6s
=> [internal] load build context 0.2s
=> => transferring context: 64.33MB 0.2s
=> [1/2] FROM docker.io/library/openjdk:17-alpine@sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81 139.3s
=> => resolve docker.io/library/openjdk:17-alpine@sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81 0.0s
=> => sha256:4b6abae565492dbe9e7a894137c966a7485154238902f2f25e9dbd9784383d81 319B / 319B 0.0s
=> => sha256:a996cdcc040704ec6badaf5fecf1e144c096e00231a29188596c784bcf858d05 951B / 951B 0.0s
=> => sha256:264c9bdce361556ba6e685e401662648358980c01151c3d977f0fdf77f7c26ab 3.48kB / 3.48kB 0.0s
=> => sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b 2.81MB / 2.81MB 4.7s
=> => sha256:53c9466125e464fed5626bde7b7a0f91aab09905f0a07e9ad4e930ae72e0fc63 928.44kB / 928.44kB 3.3s
=> => sha256:d8d715783b80cab158f5bf9726bcada5265c1624b64ca2bb46f42f94998d4662 186.80MB / 186.80MB 138.2s
=> => extracting sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b 0.0s
=> => extracting sha256:53c9466125e464fed5626bde7b7a0f91aab09905f0a07e9ad4e930ae72e0fc63 0.0s
=> => extracting sha256:d8d715783b80cab158f5bf9726bcada5265c1624b64ca2bb46f42f94998d4662 1.1s
=> [2/2] COPY target/algo-ability-1.0.0.jar algo-ability.jar 0.1s
=> exporting to image 0.2s
=> => exporting layers 0.2s
=> => writing image sha256:bd01f9f6d25dd9b9fedbf031dfbf0302717f42b6286df89d6c61041f786cf2f7 0.0s
=> => naming to docker.io/sunyuhua/algo-ability:1.0.0 0.0s
sunyuhua@sunyuhua-HKF-WXX:~/workspace/shbgit/algo-ability$
第三步:登录docker hub
sunyuhua@sunyuhua-HKF-WXX:~/workspace/shbgit/algo-ability$ docker login
Log in with your Docker ID or email address 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.
You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/
Username: sunyuhua
Password:
WARNING! Your password will be stored unencrypted in /home/sunyuhua/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
第四步:docker push
sunyuhua@sunyuhua-HKF-WXX:~/workspace/shbgit/algo-ability$ docker push sunyuhua/algo-ability:1.0.0
The push refers to repository [docker.io/sunyuhua/algo-ability]
dcab0b940e31: Pushed
34f7184834b2: Mounted from library/openjdk
5836ece05bfd: Mounted from library/openjdk
72e830a4dff5: Mounted from library/openjdk
1.0.0: digest: sha256:9185d5bbe1e172e9a72476348ee429aaf4e1a9cd176b65c9750d54cc60706e8f size: 1163