问题:当 docker logout -> docker login 用户登录,但仍然无法 docker push
$ docker push <username>/nginx-custom:v1
The push refers to repository [docker.io/jagger/nginx-custom]
340e6d3ea0c7: Preparing
941dd9dd8ee4: Preparing
f6e33ee35fd0: Preparing
9fd8b974f616: Preparing
a8b606cdf152: Preparing
cb857378ec55: Waiting
deb7d8874f38: Waiting
ace34d1d784c: Waiting
denied: requested access to the resource is denied
原因:在 docker build -t <username>/nginx-custom:v1 构建 image 或者 docker tag <username>/nginx-custom <username>/nginx-custom:v1 对镜像打标签起别名时,对镜像名中加入了用户名,而此镜像的用户名又不是 docker hub 网页端或者客户端登录的用户名,即不同用户,不属于该用户的镜像,拒绝写入登录用户的 repositories 中
解决:使用 docker tag 重新将镜像 <username> 更改为登录用户对应的用户名