docker push

将本地镜像推送到镜像仓库

语法

docker push [OPTIONS] NAME[:TAG]

参数

参数说明示例级别
--all-tags 推送所有标签 docker push --all-tags myrepo/myapp 进阶
--quiet 静默模式 docker push --quiet myrepo/myapp:1.0 常用

示例

推送到 Docker Hub

docker push username/myapp:1.0
需要先 docker login

推送到私有仓库

docker push registry.example.com/myapp:latest
镜像名必须包含仓库地址前缀

推送前打标签

docker tag myapp:latest username/myapp:1.0
docker push username/myapp:1.0
本地镜像需要先 tag 为仓库格式

常见错误

denied: requested access to the resource is denied 未登录或无权限,先执行 docker login
An image does not exist locally with the tag 本地没有该标签的镜像,先用 docker tag 打标签
error parsing HTTP 408 response body 网络超时,检查网络连接或重试

技巧

相关命令