harbor镜像仓库部署简要笔记

1、安装docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

验证安装:
[[email protected] harbor]# docker-compose -v
docker-compose version 1.24.0, build 0aa59064

2、harbor下载
github官网 https://github.com/goharbor/harbor/releases
可以离线安装或在线安装,我这里采用离线安装,直接将最新的offline包下载到本地
wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.5.tgz
harbor镜像仓库部署简要笔记

3、解压并修改harbor.cfg配置文件
[[email protected] ~]# tar zxf harbor-offline-installer-v1.7.5.tgz
[[email protected] ~]# cd harbor
[[email protected] harbor]# cat harbor.cfg |grep -E "hostname|admin_pass"|grep -v ^#
hostname = 10.0.2.10
harbor_admin_password = Harbor12345
[[email protected] harbor]#

主要修改hostname和harbor 的admin默认密码

4、执行./prepare,更新一下配置文件
5、执行./install.sh,开始安装并启动
6、测试登录
harbor镜像仓库部署简要笔记
7、后续维护
cd到harbor目录
直接docker-compose ps 查看相关容器Up信息
harbor镜像仓库部署简要笔记

如果harbor系统出现异常,也可以在harbor目录直接运行 docker-compose up -d 将会在后台启动并运行所有的容器。详细参数请参考docker-compose官方说明:
[[email protected] harbor]# docker-compose --help
Define and run multi-container applications with Docker.

Usage:
docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
docker-compose -h|--help

Options:
-f, --file FILE Specify an alternate compose file
(default: docker-compose.yml)
-p, --project-name NAME Specify an alternate project name
(default: directory name)
--verbose Show more output
--log-level LEVEL Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
--no-ansi Do not print ANSI control characters
-v, --version Print version and exit
-H, --host HOST Daemon socket to connect to

--tls Use TLS; implied by --tlsverify
--tlscacert CA_PATH Trust certs signed only by this CA
--tlscert CLIENT_CERT_PATH Path to TLS certificate file
--tlskey TLS_KEY_PATH Path to TLS key file
--tlsverify Use TLS and verify the remote
--skip-hostname-check Don't check the daemon's hostname against the
name specified in the client certificate
--project-directory PATH Specify an alternate working directory
(default: the path of the Compose file)
--compatibility If set, Compose will attempt to convert keys
in v3 files to their non-Swarm equivalent

Commands:
build Build or rebuild services
bundle Generate a Docker bundle from the Compose file
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
images List images
kill Kill containers
logs View output from containers
pause Pause services
port Print the public port for a port binding
ps List containers
pull Pull service images
push Push service images
restart Restart services
rm Remove stopped containers
run Run a one-off command
scale Set number of containers for a service
start Start services
stop Stop services
top Display the running processes
unpause Unpause services
up Create and start containers
version Show the Docker-Compose version information
[[email protected] harbor]#

参考链接:
https://docs.docker.com/compose/install/
https://blog.51cto.com/11093860/2117805
http://wiki.jikexueyuan.com/project/docker-technology-and-combat/commands.html

转载于:https://blog.51cto.com/13354560/2380219