Skip to content

Commit 5057d6e

Browse files
committed
chore: update README
1 parent ba74a4a commit 5057d6e

File tree

2 files changed

+60
-101
lines changed

2 files changed

+60
-101
lines changed

README-zh_CN.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
### 手动编译
3636

37-
```
37+
```bash
3838
go get github.com/AliyunContainerService/image-syncer
3939
cd $GOPATH/github.com/AliyunContainerService/image-syncer
4040

@@ -44,7 +44,7 @@ make
4444

4545
### 命令用例
4646

47-
```shell
47+
```bash
4848
# 获得帮助信息
4949
./image-syncer -h
5050

@@ -125,8 +125,6 @@ quay.io/coreos/kube-rbac-proxy@sha256:14b267eb38aa85fd12d0e168fffa2d8a6187ac53a1
125125

126126
--proc 并发数,进行镜像同步的并发goroutine数量,默认为5
127127

128-
--records 指定传输过程中保存已传输完成镜像信息(blob)的文件输出/读取路径,默认输出到当前工作目录,一个records记录了对应目标仓库的已迁移信息,可以用来进行连续的多次迁移(会节约大量时间,但不要把之前自己没执行过的records文件拿来用),如果有unknown blob之类的错误,可以删除该文件重新尝试,image-syncer 在 >= v1.1.0 版本中移除了对于records文件的依赖
129-
130128
--retries 失败同步任务的重试次数,默认为2,重试会在所有任务都被执行一遍之后开始,并且也会重新尝试对应次数生成失败任务的生成。一些偶尔出现的网络错误比如io timeout、TLS handshake timeout,都可以通过设置重试次数来减少失败的任务数量
131129

132130
--os 用来过滤源 tag 的 os 列表,为空则没有任何过滤要求,只对非 docker v2 schema1 media 类型的镜像格式有效

README.md

Lines changed: 58 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ English | [简体中文](./README-zh_CN.md)
1616

1717
- Support for many-to-many registry synchronization
1818
- Supports docker registry services based on Docker Registry V2 (e.g., Alibaba Cloud Container Registry Service, Docker Hub, Quay.io, Harbor, etc.)
19-
- Network & Memory Only, don't rely on large disk storage, fast synchronization
20-
- Incremental Synchronization, use a disk file to record the synchronized image blobs' information
21-
- Concurrent Synchronization, adjustable goroutine numbers
22-
- Automatic Retries of Failed Sync Tasks, to resolve the network problems while synchronizing
19+
- Network & Memory Only, doesn't rely on any large disk storage, fast synchronization
20+
- Incremental Synchronization, ignore unchanged images automatically
21+
- BloB-Level Concurrent Synchronization, adjustable goroutine numbers
22+
- Automatic Retries of Failed Sync Tasks, to resolve the network problems (rate limit, etc.) while synchronizing
2323
- Doesn't rely on Docker daemon or other programs
2424

2525
## Usage
2626

2727
### GitHub Action
2828

29-
You can use [image-sync-action](https://github.com/marketplace/actions/image-sync-action) to try image-syncer online without relying on any physical resources.
29+
You can use [image-sync-action](https://github.com/marketplace/actions/image-sync-action) to try image-syncer online without paying for any machine resources.
3030

3131
### Install image-syncer
3232

3333
You can download the latest binary release [here](https://github.com/AliyunContainerService/image-syncer/releases)
3434

3535
### Compile Manually
3636

37-
```
37+
```bash
3838
go get github.com/AliyunContainerService/image-syncer
3939
cd $GOPATH/github.com/AliyunContainerService/image-syncer
4040

@@ -44,135 +44,96 @@ make
4444

4545
### Example
4646

47-
```shell
47+
```bash
4848
# Get usage information
4949
./image-syncer -h
5050

5151
# With this command, configure file path is "./config.json", default target registry is "registry.cn-beijing.aliyuncs.com",
5252
# default target namespace is "ruohe", 6 of goroutine numbers, every failed task will be retried 3 times.
53-
./image-syncer --proc=6 --auth=./auth.json --images=./images.json --namespace=ruohe \
54-
--registry=registry.cn-beijing.aliyuncs.com --retries=3
53+
./image-syncer --proc=6 --auth=./auth.json --images=./images.json --registry=registry.cn-beijing.aliyuncs.com --retries=3
5554
```
5655

5756
### Configure Files
5857

59-
After v1.2.0, image-syncer supports both YAML and JSON format, and origin config file can be split into "auth" and "images" file. A full list of examples can be found under [example](./example), meanwhile the older version of configuration file is still supported via --config flag.
58+
Image-syncer supports `--auth` and `--images` flag for passing authentication file and image sync configuration file, both of which supports YAML and JSON format. Seperate authentication information is more flexible to reuse it in different sync missions.
59+
60+
> The older version (< v1.2.0) of configuration file is still supported via `--config` flag, you can find the example in [config.yaml](./example/config.yaml) and [config.json](./example/config.json).
6061
6162
#### Authentication file
6263

63-
Authentication file holds all the authentication information for each registry, the following is an example of `auth.json`
64-
65-
```java
66-
{
67-
// Authentication fields, each object has a URL as key and a username/password pair as value,
68-
// if authentication object is not provided for a registry, access to the registry will be anonymous.
69-
70-
"quay.io": { // This "registry" or "registry/namespace" string should be the same as registry or registry/namespace used below in "images" field.
71-
// The format of "registry/namespace" will be more prior matched than "registry"
72-
"username": "xxx", // Optional, if the value is a string of "${env}" or "$env", image-syncer will try to find the value in environment variables, after v1.3.1
73-
"password": "xxxxxxxxx", // Optional, if the value is a string of "${env}" or "$env", image-syncer will try to find the value in environment variables, after v1.3.1
74-
"insecure": true // "insecure" field needs to be true if this registry is a http service, default value is false, version of image-syncer need to be later than v1.0.1 to support this field
75-
},
76-
"registry.cn-beijing.aliyuncs.com": {
77-
"username": "xxx",
78-
"password": "xxxxxxxxx"
79-
},
80-
"docker.io": {
81-
"username": "xxx",
82-
"password": "xxxxxxxxxx"
83-
},
84-
"quay.io/coreos": { // "registry/namespace" format is supported after v1.0.3 of image-syncer
85-
"username": "abc",
86-
"password": "xxxxxxxxx",
87-
"insecure": true
88-
}
89-
}
64+
Authentication file holds all the authentication information for each registry. For each registry (or namespace), there is a object which contains username and password. For each images sync rule in image sync configuration file, image-syncer will try to find a match in all the authentication information and use the best(longest) fit one. Access will be anonymous if no authentication information is found.
65+
66+
You can find the example in [auth.yaml](./example/auth.yaml) and [auth.json](./example/auth.json), here we use [auth.yaml](./example/auth.yaml) for explaination:
67+
68+
```yaml
69+
quay.io: # This "registry" or "registry/namespace" string should be the same as registry or registry/namespace used below in image sync rules. And if an url match multiple objects, the "registry/namespace" string will actually be used.
70+
username: xxx
71+
password: xxxxxxxxx
72+
insecure: true # Optional, "insecure" field needs to be true if this registry is a http service, default value is false.
73+
registry.cn-beijing.aliyuncs.com:
74+
username: xxx # Optional, if the value string is a format of "${env}" or "$env", use the "env" environment variables as username.
75+
password: xxxxxxxxx # Optional, if the value string is a format of "${env}" or "$env", use the "env" environment variables as password.
76+
docker.io:
77+
username: "${env}"
78+
password: "$env"
79+
quay.io/coreos:
80+
username: abc
81+
password: xxxxxxxxx
82+
insecure: true
9083
```
9184
9285
#### Image sync configuration file
9386
94-
Image sync configuration file defines all the image synchronization rules, the following is an example of `images.json`
95-
96-
```java
97-
{
98-
// Rules of image synchronization, each rule is a kv pair of source(key) and destination(value).
99-
100-
// The source of each rule should not be empty string.
101-
102-
// If you need to synchronize images from one source to multi destinations, add more rules.
103-
104-
// Both source and destination are docker image url (registry/namespace/repository:tag),
105-
// with or without tags.
106-
107-
// For both source and destination, if destination is not an empty string, "registry/namespace/repository"
108-
// is needed at least.
109-
110-
// You cannot synchronize a whole namespace or a registry but a repository for one rule at most.
111-
112-
// The repository name and tag of destination can be deferent from source, which works like
113-
// "docker pull + docker tag + docker push"
87+
Image sync configuration file defines all the image synch rules. Each rule is a key/value pair, of which the key refers to "the source images url" and the value refers to "the destination images url". The source/destination images url is mostly the same with the url we use
88+
in `docker pull/push` commands, but still something different in the "tags and digest" part:
11489

115-
"quay.io/coreos/kube-rbac-proxy": "quay.io/ruohe/kube-rbac-proxy",
116-
"xxxx":"xxxxx",
117-
"xxx/xxx/xx:tag1,tag2,tag3":"xxx/xxx/xx"
90+
1. The source images url cannot be empty.
91+
2. If the source images url contains no tags or digest, all the tags of source repository will be synced.
92+
3. The source images url can have more than one tags, which should be seperated by comma, only the specified tags will be synced.
93+
4. The source images url can at most one digest, and the destination url should only have no digest or the same digest at the same time.
94+
5. If the destination url has no digest or tags, it means the source images will keep the same tags or digest after being synced.
95+
6. The destination url can have more than one tags, the number of which must be the same with the tags in the source images url, then all the source images' tags will be changed to a new one (correspond from left to right).
96+
7. If the destination url is empty, all the source images will be synced to the "default registry" (by command line parameter) and in the same repository with the source images url.
11897

119-
// If a source doesn't include tags, it means all the tags of this repository need to be synchronized,
120-
// destination should not include tags at this moment.
121-
122-
// Each source can include more than one tags, which is split by comma (e.g., "a/b/c:1", "a/b/c:1,2,3").
98+
You can find the example in [images.yaml](./example/images.yaml) and [images.json](./example/images.json), here we use [images.yaml](./example/images.yaml) for explaination:
12399

124-
// If a source includes just one tag (e.g., "a/b/c:1"), it means only one tag need to be synchronized;
125-
// at this moment, if the destination doesn't include a tag, synchronized image will keep the same tag.
126-
127-
// When a source includes more than one tag (e.g., "a/b/c:1,2,3"), at this moment,
128-
// the destination should not include tags, synchronized images will keep the original tags.
129-
// e.g., "a/b/c:1,2,3":"x/y/z".
130-
131-
// When a destination is an empty string, source will be synchronized to "default-registry/default-namespace"
132-
// with the same repository name and tags, default-registry and default-namespace can be set by both parameters
133-
// and environment variable.
134-
}
100+
```yaml
101+
quay.io/coreos/kube-rbac-proxy: quay.io/ruohe/kube-rbac-proxy
102+
quay.io/coreos/kube-rbac-proxy:v1.0: quay.io/ruohe/kube-rbac-proxy
103+
quay.io/coreos/kube-rbac-proxy:v1.0,v2.0: quay.io/ruohe/kube-rbac-proxy
104+
quay.io/coreos/kube-rbac-proxy@sha256:14b267eb38aa85fd12d0e168fffa2d8a6187ac53a14a0212b0d4fce8d729598c: quay.io/ruohe/kube-rbac-proxy
135105
```
136106

137107
### Parameters
138108

139109
```
140-
-h --help usage information
110+
-h --help Usage information
141111

142-
--config set the path of config file, this file need to be created before starting synchronization, default
112+
--config Set the path of config file, this file need to be created before starting synchronization, default
143113
config file is at "current/working/directory/config.json". (This flag can be replaced with flag --auth
144114
and --images which for better orgnization.)
145115

146-
--auth set the path of authentication file, this file need to be created before starting synchronization, default
116+
--auth Set the path of authentication file, this file need to be created before starting synchronization, default
147117
config file is at "current/working/directory/auth.json". This flag need to be pair used with --images.
148118

149-
--images set the path of image rules file, this file need to be created before starting synchronization, default
119+
--images Set the path of image rules file, this file need to be created before starting synchronization, default
150120
config file is at "current/working/directory/images.json". This flag need to be pair used with --auth.
151121

152-
--log set the path of log file, logs will be printed to Stderr by default
122+
--log Set the path of log file, logs will be printed to Stderr by default
153123

154-
--namespace set default-namespace, default-namespace can also be set by environment variable "DEFAULT_NAMESPACE",
155-
if they are both set at the same time, "DEFAULT_NAMESPACE" will not work at this synchronization,
156-
default-namespace will work only if default-registry is not empty.
124+
--registry Set default-registry, default-registry can also be set by environment variable "DEFAULT_REGISTRY",
125+
if they are both set at the same time, "DEFAULT_REGISTRY" will not work at this synchronization.
157126

158-
--registry set default-registry, default-registry can also be set by environment variable "DEFAULT_REGISTRY",
159-
if they are both set at the same time, "DEFAULT_REGISTRY" will not work at this synchronization,
160-
default-registry will work only if default-namespace is not empty.
127+
--proc Number of goroutines, default value is 5
161128

162-
--proc number of goroutines, default value is 5
129+
--retries Times to retry failed tasks, default value is 2, the retries of failed tasks will start after all the tasks
130+
are executed once, this can resolve most occasional network problems during synchronization
163131

164-
--records image-syncer will record the information of synchronized image blobs to a disk file, this parameter will
165-
set the path of the records file, default path is "current/working/directory/records", a records file can be
166-
reused to make incremental synchronization if it is really generated by yourself. image-syncer remove the
167-
dependence of records file after v1.1.0
132+
--os OS list to filter source tags, not works for docker v2 schema1 media, takes no effect if empty
168133

169-
--retries number of retries, default value is 2, the retries of failed sync tasks will start after all sync tasks
170-
are executed once, reties of failed sync tasks will resolve most occasional network problems during
171-
synchronization
134+
--arch Architecture list to filter source tags, takes no effect if empty
172135

173-
--os os list to filter source tags, not works for docker v2 schema1 media, takes no effect if empty
174-
175-
--arch architecture list to filter source tags, takes no effect if empty
136+
--force Force update manifest whether the destination manifest exists
176137
```
177138
178139
### FAQs

0 commit comments

Comments
 (0)