# docker配置目录下创建daemon.json配置文件
vim /etc/docker/daemon.json
{
"insecure-registries": ["10.100.210.222"]
}
:wqsystemctl restart docker由于重启了docker服务,之前处于运行状态下的harbor各个容器会退出。需确保其运行
#根据以下命令可查询运行中的service
[root@harbor ~]# docker compose ls # 也可以使用docker-compose命令
NAME STATUS CONFIG FILES
harbor running(9) /data/harbor/docker-compose.yml
# 执行命令,确保各容器启动
cd /data/harbor/
[root@harbor harbor]# docker compose up -d # 此处也可以使用docker-compose命令。
[+] Running 9/9
⠿ Container harbor-log Running 0.0s
⠿ Container registryctl Started 10.3s
⠿ Container redis Started 10.7s
⠿ Container harbor-db Started 5.8s
⠿ Container harbor-portal Running 0.0s
⠿ Container registry Started 9.2s
⠿ Container harbor-core Started 14.7s
⠿ Container nginx Started 20.5s
⠿ Container harbor-jobservice Started
[root@harbor harbor]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
25cac3f15dd9 goharbor/nginx-photon:v2.5.3 "nginx -g 'daemon of…" 34 hours ago Up 6 minutes (healthy) 0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp nginx
856b38829f49 goharbor/harbor-jobservice:v2.5.3 "/harbor/entrypoint.…" 34 hours ago Up 6 minutes (healthy) harbor-jobservice
8dc9df4c5dc7 goharbor/harbor-core:v2.5.3 "/harbor/entrypoint.…" 34 hours ago Up 7 minutes (healthy) harbor-core
e33e13deecf3 goharbor/harbor-registryctl:v2.5.3 "/home/harbor/start.…" 34 hours ago Up 7 minutes (healthy) registryctl
70ef5c03460f goharbor/registry-photon:v2.5.3 "/home/harbor/entryp…" 34 hours ago Up 7 minutes (healthy) registry
d9d2c17432fa goharbor/harbor-db:v2.5.3 "/docker-entrypoint.…" 34 hours ago Up 7 minutes (healthy) harbor-db
034d4bc12e7b goharbor/redis-photon:v2.5.3 "redis-server /etc/r…" 34 hours ago Up 7 minutes (healthy) redis
551f7636a1d6 goharbor/harbor-portal:v2.5.3 "nginx -g 'daemon of…" 34 hours ago Up 8 minutes (healthy) harbor-portal
71a27b822354 goharbor/harbor-log:v2.5.3 "/bin/sh -c /usr/loc…" 34 hours ago Up 8 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-log
此处登录所使用的账号,可以不是admin账号,若要使用其他账号,需要在harbor “系统管理“ ”用户管理” 新建用户,并分配某个仓库的权限。
# 登录
[root@harbor harbor]# docker login https://10.100.202.211
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
# 登出
[root@harbor harbor]# docker logout https://10.100.202.211
Removing login credentials for 10.100.202.211给dev用户授予`harbor-2.5.3`项目的权限:
使用dev用户登录harbor仓库:
[root@harbor harbor]# docker login https://10.100.202.211
Username: dev
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给本地镜像打tag并推送到harbro
以goharbor/redis-photon镜像为例演示:
[root@harbor harbor]# docker tag goharbor/redis-photon:v2.5.3 10.100.202.211/harbor-2.5.3/redis-photon:v2.5.3
[root@harbor harbor]# docker push 10.100.202.211/harbor-2.5.3/redis-photon:v2.5.3
The push refers to repository [10.100.202.211/harbor-2.5.3/redis-photon]
55f587609a73: Pushed
b4e26556ed44: Pushed
0e3d87aacbc9: Pushed
005d5db57e06: Pushed
ed825a5a3f34: Pushed
v2.5.3: digest: sha256:3da6f5c65f56e94bb864ef419f47d7af4f677a26edeac3aec3b4f38619fd8ae8 size: 1366其他镜像,类似的操作,逐一打tag随后推送到harbor仓库即可。
harbor所有相关镜像均推送后的状态:
如此,其他docker宿主机可在添加harbor仓库为信任仓库并重启docker服务后,从该仓库拉去所需镜像或想harbor仓库推送已有镜像,供其他人使用了。
| 留言与评论(共有 0 条评论) “” |