harbor登录与使用
1、修改daemon.json
vim /etc/docker/daemon.json
没有则创建文件
添加insecure-registries
{ "registry-mirrors": [ "https://registry.docker-cn.com" ], "insecure-registries": [ "ip" ], "log-driver": "json-file", "log-opts": { "max-size": "100m", "max-file": "5" } }
2、生成秘钥文件
mkdir -p /etc/docker/certs.d/ip cd /etc/docker/certs.d/ip openssl req -newkey rsa:4096 -nodes -sha256 -keyout xxx.key -x509 -days 3650 -out xxx.cre
3、重启docker并且登录
sudo service docker restart sudo docker login ip -u 用户名 -p 密码
4、拉取镜像
docker pull ip/镜像
常见问题及解决方式
一、如果docker login出现Error response from daemon: Get https://ip/v2/: Get https://xxx/service/token?account=harbor&client_id=docker&offline_token=true&service=harbor-registry: dial tcp: lookup xxx: no such host错误
执行如下命令修改hosts:
vim /etc/hosts
增加如下配置
ip xxx
二、如果出现WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error saving credentials: error storing credentials - err: exit status 1, out: `Error calling StartServiceByName for org.freedesktop.secrets: Timeout was reached`
造成原因:是Ubuntu软件包的一个错误。
解决方法:
sudo apt-get remove golang-docker-credential-helpers