update install and user guide

This commit is contained in:
Henry Zhang 2016-11-10 17:19:35 +08:00
parent 811b472af4
commit 2b0cf6a5e0
2 changed files with 36 additions and 36 deletions

View File

@ -127,25 +127,25 @@ Harbor does not ship with any certificates, and, by default, uses HTTP to serve
### Managing Harbor's lifecycle ### Managing Harbor's lifecycle
You can use docker-compose to manage the lifecycle of Harbor. Some useful commands are listed as follows (must run in the same directory as *docker-compose.yml*). You can use docker-compose to manage the lifecycle of Harbor. Some useful commands are listed as follows (must run in the same directory as *docker-compose.yml*).
Stop Harbor: Stopping Harbor:
``` ```
$ sudo docker-compose stop $ sudo docker-compose stop
Stopping harbor_proxy_1 ... done Stopping nginx ... done
Stopping harbor_ui_1 ... done Stopping harbor-jobservice ... done
Stopping harbor_registry_1 ... done Stopping harbor-ui ... done
Stopping harbor_mysql_1 ... done Stopping harbor-db ... done
Stopping harbor_log_1 ... done Stopping registry ... done
Stopping harbor_jobservice_1 ... done Stopping harbor-log ... done
``` ```
Restart Harbor after stopping: Restarting Harbor after stopping:
``` ```
$ sudo docker-compose start $ sudo docker-compose start
Starting harbor_log_1 Starting log ... done
Starting harbor_mysql_1 Starting ui ... done
Starting harbor_registry_1 Starting mysql ... done
Starting harbor_ui_1 Starting jobservice ... done
Starting harbor_proxy_1 Starting registry ... done
Starting harbor_jobservice_1 Starting proxy ... done
``` ```
To change Harbor's configuration, first stop existing Harbor instance, update harbor.cfg, and then run install.sh again: To change Harbor's configuration, first stop existing Harbor instance, update harbor.cfg, and then run install.sh again:
@ -157,20 +157,20 @@ $ vim harbor.cfg
$ sudo install.sh $ sudo install.sh
``` ```
Remove Harbor's containers while keeping the image data and Harbor's database files on the file system: Removing Harbor's containers while keeping the image data and Harbor's database files on the file system:
``` ```
$ sudo docker-compose rm $ sudo docker-compose rm
Going to remove harbor_proxy_1, harbor_ui_1, harbor_registry_1, harbor_mysql_1, harbor_log_1, harbor_jobservice_1 Going to remove nginx, harbor-jobservice, registry, harbor-ui, harbor-db, harbor-log
Are you sure? [yN] y Are you sure? [yN] y
Removing harbor_proxy_1 ... done Removing nginx ... done
Removing harbor_ui_1 ... done Removing harbor-jobservice ... done
Removing harbor_registry_1 ... done Removing registry ... done
Removing harbor_mysql_1 ... done Removing harbor-ui ... done
Removing harbor_log_1 ... done Removing harbor-db ... done
Removing harbor_jobservice_1 ... done Removing harbor-log ... done
``` ```
Remove Harbor's database and image data (for a clean re-installation): Removing Harbor's database and image data (for a clean re-installation):
```sh ```sh
$ rm -r /data/database $ rm -r /data/database
$ rm -r /data/registry $ rm -r /data/registry
@ -277,14 +277,14 @@ $ sudo install.sh
1. When Harbor does not work properly, run the below commands to find out if all containers of Harbor are in **UP** status: 1. When Harbor does not work properly, run the below commands to find out if all containers of Harbor are in **UP** status:
``` ```
$ sudo docker-compose ps $ sudo docker-compose ps
Name Command State Ports Name Command State Ports
----------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------
harbor_jobservice_1 /harbor/harbor_jobservice Up harbor-db docker-entrypoint.sh mysqld Up 3306/tcp
harbor_log_1 /bin/sh -c crond && rsyslo ... Up 0.0.0.0:1514->514/tcp harbor-jobservice /harbor/harbor_jobservice Up
harbor_mysql_1 /entrypoint.sh mysqld Up 3306/tcp harbor-log /bin/sh -c crond && rsyslo ... Up 0.0.0.0:1514->514/tcp
harbor_proxy_1 nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp harbor-ui /harbor/harbor_ui Up
harbor_registry_1 /entrypoint.sh serve /etc/ ... Up 5000/tcp nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
harbor_ui_1 /harbor/harbor_ui Up registry /entrypoint.sh serve /etc/ ... Up 5000/tcp
``` ```
If a container is not in **UP** state, check the log file of that container in directory ```/var/log/harbor```. For example, if the container ```harbor_ui_1``` is not running, you should look at the log file ```docker_ui.log```. If a container is not in **UP** state, check the log file of that container in directory ```/var/log/harbor```. For example, if the container ```harbor_ui_1``` is not running, you should look at the log file ```docker_ui.log```.

View File

@ -163,19 +163,19 @@ the repository is no longer managed in Harbor, however, the files of the reposit
Next, delete the actual files of the repository using the registry's garbage collection(GC). Make sure that no one is pushing images or Harbor is not running at all before you perform a GC. If someone were pushing an image while GC is running, there is a risk that the image's layers will be mistakenly deleted which results in a corrupted image. So before running GC, a preferred approach is to stop Harbor first. Next, delete the actual files of the repository using the registry's garbage collection(GC). Make sure that no one is pushing images or Harbor is not running at all before you perform a GC. If someone were pushing an image while GC is running, there is a risk that the image's layers will be mistakenly deleted which results in a corrupted image. So before running GC, a preferred approach is to stop Harbor first.
Run the below commands on the host which Harbor is deployed on to preview what files/images will be affect: Run the below commands on the host which Harbor is deployed on to preview what files/images will be affected:
```sh ```sh
$ docker-compose stop $ docker-compose stop
$ docker run -it --name gc --rm --volumes-from deploy_registry_1 registry:2.5.0 garbage-collect --dry-run /etc/registry/config.yml $ docker run -it --name gc --rm --volumes-from registry registry:2.5.0 garbage-collect --dry-run /etc/registry/config.yml
``` ```
**NOTE:** The above option "--dry-run" will print the progress without removing any data. **NOTE:** The above option "--dry-run" will print the progress without removing any data.
Verify the result of the above test, then use the below commands to perform garbage collection and restart Harbor. Verify the result of the above test, then use the below commands to perform garbage collection and restart Harbor.
```sh ```sh
$ docker run -it --name gc --rm --volumes-from deploy_registry_1 registry:2.5.0 garbage-collect /etc/registry/config.yml $ docker run -it --name gc --rm --volumes-from registry registry:2.5.0 garbage-collect /etc/registry/config.yml
$ docker-compose start $ docker-compose start
``` ```
For more information about GC, please see [GC](https://github.com/docker/docker.github.io/blob/master/registry/garbage-collection.md). For more information about GC, please see [GC](https://github.com/docker/docker.github.io/blob/master/registry/garbage-collection.md).