本文最后更新于2 天前,其中的信息可能已经过时,如有错误请发送邮件到2639131093@qq.com
基于centos 7.9.2009 x86_64
docker基础安装
安装yum-utils
用来允许yum-config拉取docker源
拉取docker源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
删除旧版
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装docker ce 社区版
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
我的k8s部署使用的是:
yum install docker-ce-24.0.6 docker-ce-cli-24.0.6 containerd.io docker-compose-plugin
docker开启与自启动
docker验证
查看版本
查看信息
[root@docker ~]# docker info
Client: Docker Engine - Community
Version: 24.0.6
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.14.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 24.0.6
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: d2d58213f83a351ca8f528a95fbd145f5654e957
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 3.10.0-1160.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 4.589GiB
Name: docker
ID: 5b645e99-f4ab-4dd3-8c2f-3a9a5a98ae68
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://qg5zetce.mirror.aliyuncs.com/
Live Restore Enabled: false
配置阿里云镜像加速器
地址:容器镜像服务
镜像工具——镜像加速器
选择centos,按照教程进行
阿里云的源,好像也死了我醉了
这里使用国内小云
{
"registry-mirrors": [
"https://4a1qkm2x.mirror.aliyuncs.com",
"https://docker.1panel.live",
"https://hub.rat.dev"
]
}
运行hello-world镜像
registry私有仓库
拉取
docker pull registry
启动
docker run -d -p 5000:5000 --restart=always --name registry registry:latest
web查看
虚拟机ip:5000/v2/
harbor仓库
通过linux命令拉取
wget https://github.com/goharbor/harbor/releases/download/v2.10.0/harbor-offline-installer-v2.10.0.tgz
github离线下载
https://github.com/goharbor/harbor/releases
这里展示linux在线拉取
需要先把部署的registry删除
解压
配置主配置文件
cp harbor.yml.tmpl harbor.yml #拷贝
vim harbor.yml
# Configuration file of Harbor
# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.32.62.150 ##没映射那就ip地址
# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 5000 #配置启动端口号
# https related config
#https: #由于没有ssl证书,将https相关注释掉
# https port for harbor, default is 443
# port: 443
# The path of cert and key files for nginx
certificate: /your/certificate/path
private_key: /your/private/key/path
# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
# # set enabled to true means internal tls is enabled
# enabled: true
# # put your cert and key files on dir
# dir: /etc/harbor/tls/internal
# # enable strong ssl ciphers (default: false)
# strong_ssl_ciphers: false
# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: 123456 ##此处为admin密码
启动
通过脚本文件安装
在harbor根目录内
输入:
. install.sh
[root@docker harbor]# . install.sh
dirname:无效选项 -- b
Try 'dirname --help' for more information.
[Step 0]: checking if docker is installed ...
Note: docker version: 24.0.6
[Step 1]: checking docker-compose is installed ...
Note: Docker Compose version v2.27.1
[Step 2]: loading Harbor images ...
ad00c0c1d948: Loading layer [==================================================>] 40.11MB/40.11MB
7570a78aea36: Loading layer [==================================================>] 9.08MB/9.08MB
04774e0e84f2: Loading layer [==================================================>] 4.096kB/4.096kB
8a42710a9f5a: Loading layer [==================================================>] 3.072kB/3.072kB
f1990e77f8e5: Loading layer [==================================================>] 197MB/197MB
172f5af926be: Loading layer [==================================================>] 17.6MB/17.6MB
2bef5dd17a10: Loading layer [==================================================>] 215.4MB/215.4MB
Loaded image: goharbor/trivy-adapter-photon:v2.10.0
8c10ac3a40a9: Loading layer [==================================================>] 89.84MB/89.84MB
cc741ba6af65: Loading layer [==================================================>] 65.11MB/65.11MB
7877ea7046dd: Loading layer [==================================================>] 13.2MB/13.2MB
3de91a0984fe: Loading layer [==================================================>] 65.54kB/65.54kB
4d2cda613456: Loading layer [==================================================>] 2.56kB/2.56kB
625b81c9e514: Loading layer [==================================================>] 1.536kB/1.536kB
6496ec4ce84e: Loading layer [==================================================>] 12.29kB/12.29kB
2b332fb0075b: Loading layer [==================================================>] 5.322MB/5.322MB
f8976ae46d77: Loading layer [==================================================>] 457.7kB/457.7kB
Loaded image: goharbor/prepare:v2.10.0
a36cb8a4e510: Loading layer [==================================================>] 126.1MB/126.1MB
fd72ef63aacc: Loading layer [==================================================>] 3.584kB/3.584kB
162d9960a2b9: Loading layer [==================================================>] 3.072kB/3.072kB
b71508b0d586: Loading layer [==================================================>] 2.56kB/2.56kB
18c685e189cb: Loading layer [==================================================>] 3.072kB/3.072kB
84690af2e82b: Loading layer [==================================================>] 3.584kB/3.584kB
8d7eb73e8207: Loading layer [==================================================>] 20.48kB/20.48kB
Loaded image: goharbor/harbor-log:v2.10.0
001da4979db8: Loading layer [==================================================>] 8.562MB/8.562MB
275281f671bf: Loading layer [==================================================>] 4.096kB/4.096kB
f6856e2d539f: Loading layer [==================================================>] 17.4MB/17.4MB
557317f3c1c5: Loading layer [==================================================>] 3.072kB/3.072kB
942b8c3060c6: Loading layer [==================================================>] 32.81MB/32.81MB
b2bc30e737e7: Loading layer [==================================================>] 51MB/51MB
Loaded image: goharbor/harbor-registryctl:v2.10.0
d5e5478da184: Loading layer [==================================================>] 116.8MB/116.8MB
Loaded image: goharbor/nginx-photon:v2.10.0
74a7f6a8de8c: Loading layer [==================================================>] 11.58MB/11.58MB
46523ccaf371: Loading layer [==================================================>] 27.6MB/27.6MB
3cea6b428022: Loading layer [==================================================>] 4.608kB/4.608kB
9815d4ae0f06: Loading layer [==================================================>] 28.39MB/28.39MB
Loaded image: goharbor/harbor-exporter:v2.10.0
7d7e15ae8ca1: Loading layer [==================================================>] 15.93MB/15.93MB
e13b0ff80947: Loading layer [==================================================>] 111.8MB/111.8MB
da74a4230588: Loading layer [==================================================>] 3.072kB/3.072kB
89240f6f343b: Loading layer [==================================================>] 59.9kB/59.9kB
7b00214da46a: Loading layer [==================================================>] 61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.10.0
345fdbd05997: Loading layer [==================================================>] 8.562MB/8.562MB
5c4443929555: Loading layer [==================================================>] 4.096kB/4.096kB
605c9788ef17: Loading layer [==================================================>] 3.072kB/3.072kB
b2ab56de0e45: Loading layer [==================================================>] 17.4MB/17.4MB
950eb2734789: Loading layer [==================================================>] 18.19MB/18.19MB
Loaded image: goharbor/registry-photon:v2.10.0
7693164e30e0: Loading layer [==================================================>] 116.8MB/116.8MB
6b50b5d516aa: Loading layer [==================================================>] 6.531MB/6.531MB
5aea217650ad: Loading layer [==================================================>] 246.8kB/246.8kB
0b3de92ff70b: Loading layer [==================================================>] 1.477MB/1.477MB
Loaded image: goharbor/harbor-portal:v2.10.0
b79ac58f353c: Loading layer [==================================================>] 11.58MB/11.58MB
18c4c015e339: Loading layer [==================================================>] 3.584kB/3.584kB
c6eef6a39935: Loading layer [==================================================>] 2.56kB/2.56kB
03db56130352: Loading layer [==================================================>] 58.57MB/58.57MB
78c9748f2d29: Loading layer [==================================================>] 5.632kB/5.632kB
e1732f90232a: Loading layer [==================================================>] 123.4kB/123.4kB
6b733e4833c8: Loading layer [==================================================>] 80.38kB/80.38kB
fe6828cc147a: Loading layer [==================================================>] 59.56MB/59.56MB
8e1349c44768: Loading layer [==================================================>] 2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.10.0
02b0385778eb: Loading layer [==================================================>] 15.93MB/15.93MB
ac2be26232ee: Loading layer [==================================================>] 175MB/175MB
1e3e9dba5eaa: Loading layer [==================================================>] 25.47MB/25.47MB
c7fa85d79c1c: Loading layer [==================================================>] 18.14MB/18.14MB
f9ef6596c7ce: Loading layer [==================================================>] 5.12kB/5.12kB
e35036cc139f: Loading layer [==================================================>] 6.144kB/6.144kB
0cb7ded8041a: Loading layer [==================================================>] 3.072kB/3.072kB
5d178abacde0: Loading layer [==================================================>] 2.048kB/2.048kB
67fe09fd709b: Loading layer [==================================================>] 2.56kB/2.56kB
d0b4aac335c4: Loading layer [==================================================>] 7.68kB/7.68kB
Loaded image: goharbor/harbor-db:v2.10.0
fced8697b2c7: Loading layer [==================================================>] 11.58MB/11.58MB
af968b902c26: Loading layer [==================================================>] 3.584kB/3.584kB
7caaebde63bc: Loading layer [==================================================>] 2.56kB/2.56kB
d6e3c7a6ef36: Loading layer [==================================================>] 44.96MB/44.96MB
bc8a8ef654ea: Loading layer [==================================================>] 45.75MB/45.75MB
Loaded image: goharbor/harbor-jobservice:v2.10.0
[Step 3]: preparing environment ...
[Step 4]: preparing harbor configs ...
prepare base dir is set to /etc/yum.repos.d/harbor
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir
Note: stopping existing Harbor instance ...
WARN[0000] /etc/yum.repos.d/harbor/docker-compose.yml: `version` is obsolete
[Step 5]: starting Harbor ...
WARN[0000] /etc/yum.repos.d/harbor/docker-compose.yml: `version` is obsolete
[+] Running 10/10
✔ Network harbor_harbor Created 0.9s
✔ Container harbor-log Started 1.4s
✔ Container redis Started 2.1s
✔ Container harbor-portal Started 2.6s
✔ Container harbor-db Started 2.3s
✔ Container registry Started 2.4s
✔ Container registryctl Started 2.5s
✔ Container harbor-core Started 3.1s
✔ Container nginx Started 4.1s
✔ Container harbor-jobservice Started 3.8s
✔ ----Harbor has been installed and started successfully.----
访问
输入:访问IP+端口
登录后页面
评论