1. 构建镜像
docker build -t your-image-name:your-tag .
# 打个标签
docker tag your-image-name:your-tag [DOCKERHUB 账号名]/[镜像名]:[版本号]
2. 推送镜像
# DOCKERHUB_PASSWD 可以是生成的令牌
docker login -u [DockerHub 账号名] -p ${DOCKERHUB_PASSWD}
# 推送
docker push [DockerHub 账号名]/[镜像名]:[版本号]
参考:https://coding.net/help/docs/ci/practice/dockerhub.html