在harbor测试push/pull命令时,出现了下面错误
[root@harbor-28 harbor]# docker push harbor/test/nginx
The push refers to a repository [docker.io/harbor/test/nginx] #注意这里
6c7de695ede3: Preparing
2f4accd375d9: Preparing
ffc9b21953f4: Preparing
denied: requested access to the resource is denied
一般是因为没有登录,登录即可:
[root@harbor-28 harbor]#docker login [harbor地址]
Username : [harbor账号]
Password: [harbor密码]
Login Succeeded
然而我当时没有解决,原因是因为默认总是强制上传到docker.io中,因此我做了以下修改:
1. 修改/etc/hosts
[自己ip] harbor.io #最好不要写harbor,随便定义
2. 停掉docker、docker-compose、harbor,修改/etc/docker/daemon.json,修改/harbor/harbor.cfg(有些是.yml)