跳转至

6. habor仓库基本使用

1. 登录测试

# 10.0.8.8
docker login 10.0.8.8:800
# 输入:admin
# 密码
root@baiduyun:/opt/harbor/harbor# docker login 10.0.8.8:800
Username: admin
Password:
Error response from daemon: Get "https://10.0.8.8:800/v2/": http: server gave HTTP response to HTTPS client

# 需要https,而我们使用的是http,解决方法见第二步!

2. 设置docker信任harbor仓库

vim /etc/docker/daemon.json
# 添加如下一行,将harbor仓库的地址设置为信任
"insecure-registries": ["10.0.8.8:800"]
{
"registry-mirrors":["https://registry.docker-cn.com","https://q9uerbko.mirror.aliyuncs.com","http://hub-mirror.c.163.com", "https://docker.mirrors.ustc.edu.cn"],
"exec-opts":["native.cgroupdriver=systemd"],
"insecure-registries": ["10.0.8.8:800"]
}

3. 重启docker

systemctl restart docker

4. 登录

docker login 10.0.8.8:800
root@baiduyun:/opt/harbor/harbor# docker login 10.0.8.8:800
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

5. 新建仓库

# 页面中,点击项目-新建项目,输入项目名称:chupeng,点击确定

img.png

6. 给需要上传的镜像打tag

# 以busybox为例
docker tage busybox:latest 10.0.8.8:800/chupeng/busybox:v1

7. 上传

docker push 10.0.8.8:800/chupeng/busybox:v1
# 页面中查看,上传成功!!!

img_1.png


最后更新: 2022-02-22 04:55:01