2018-07-09 15:27:01 +02:00
% skopeo-sync(1)
## NAME
2022-08-22 19:46:58 +02:00
skopeo\-sync - Synchronize images between registry repositories and local directories.
2018-07-09 15:27:01 +02:00
## SYNOPSIS
2021-06-28 16:17:13 -06:00
**skopeo sync** [*options*] --src _ transport _ --dest _ transport _ _ source _ _ destination _
2018-07-09 15:27:01 +02:00
## DESCRIPTION
2023-02-22 15:30:02 +00:00
Synchronize images between registry repositories and local directories. Synchronization is achieved by copying all the images found at _ source _ to _ destination _ - useful when synchronizing a local container registry mirror or for populating registries running inside of air-gapped environments.
2018-07-09 15:27:01 +02:00
Differently from other skopeo commands, skopeo sync requires both source and destination transports to be specified separately from _ source _ and _ destination _ .
One of the problems of prefixing a destination with its transport is that, the registry `docker://hostname:port` would be wrongly interpreted as an image reference at a non-fully qualified registry, with `hostname` and `port` the image name and tag.
Available _ source _ transports:
- _docker_ (i.e. `--src docker` ): _ source _ is a repository hosted on a container registry (e.g.: `registry.example.com/busybox` ).
If no image tag is specified, skopeo sync copies all the tags found in that repository.
- _dir_ (i.e. `--src dir` ): _ source _ is a local directory path (e.g.: `/media/usb/` ). Refer to skopeo(1) **dir:**_path_ for the local image format.
- _yaml_ (i.e. `--src yaml` ): _ source _ is local YAML file path.
The YAML file should specify the list of images copied from different container registries (local directories are not supported). Refer to EXAMPLES for the file format.
Available _ destination _ transports:
- _docker_ (i.e. `--dest docker` ): _ destination _ is a container registry (e.g.: `my-registry.local.lan` ).
- _dir_ (i.e. `--dest dir` ): _ destination _ is a local directory path (e.g.: `/media/usb/` ).
One directory per source 'image:tag' is created for each copied image.
When the `--scoped` option is specified, images are prefixed with the source image path so that multiple images with the same
name can be stored at _ destination _ .
## OPTIONS
2023-03-20 21:12:51 +01:00
See also [skopeo(1) ](skopeo.1.md ) for options placed before the subcommand name.
2021-06-29 15:56:07 -06:00
**--all**, * * -a**
2020-08-04 22:02:17 -06:00
If one of the images in __src __ refers to a list of images, instead of copying just the image which matches the current OS and
architecture (subject to the use of the global --override-os, --override-arch and --override-variant options), attempt to copy all of
the images in the list, and the list itself.
2018-07-09 15:27:01 +02:00
**--authfile** _ path _
2025-05-29 00:30:19 +02:00
Path of the primary registry credentials file. On Linux, the default is ${XDG\_RUNTIME\_DIR}/containers/auth.json.
See **containers-auth.json ** (5) for more details about the credential search mechanism and defaults on other platforms.
Use `skopeo login` to manage the credentials.
The default value of this option is read from the `REGISTRY\_AUTH\_FILE` environment variable.
2018-07-09 15:27:01 +02:00
2020-01-10 12:41:43 +01:00
**--src-authfile** _ path _
2025-05-29 00:30:19 +02:00
Path of the primary registry credentials file for the source registry. Uses path given by `--authfile` , if not provided.
2020-01-10 12:41:43 +01:00
**--dest-authfile** _ path _
2025-05-29 00:30:19 +02:00
Path of the primary registry credentials file for the destination registry. Uses path given by `--authfile` , if not provided.
2020-01-10 12:41:43 +01:00
2022-03-28 08:40:12 -04:00
**--dry-run**
Run the sync without actually copying data to the destination.
2021-06-29 15:56:07 -06:00
**--src**, * * -s** _ transport _ Transport for the source repository.
2018-07-09 15:27:01 +02:00
2021-06-29 15:56:07 -06:00
**--dest**, * * -d** _ transport _ Destination transport.
2018-07-09 15:27:01 +02:00
2021-06-29 15:56:07 -06:00
**--format**, * * -f** _ manifest-type _ Manifest Type (oci, v2s1, or v2s2) to use when syncing image(s) to a destination (default is manifest type of source, with fallbacks).
**--help**, * * -h**
Print usage statement.
2021-04-23 12:59:19 -07:00
2018-07-09 15:27:01 +02:00
**--scoped** Prefix images with the source image path, so that multiple images with the same name can be stored at _ destination _ .
2022-11-17 17:49:27 +00:00
**--append-suffix** _ tag-suffix _ String to append to destination tags.
2022-11-13 13:55:40 +00:00
2024-08-19 16:43:42 +01:00
**--digestfile** _ path _
After copying the images from source, write the digest of the resulting images along with Image Reference.
```
sha256:bf91f90823248017a4f920fb541727fa8368dc6cf377a7debbd271cf6a31c8a7 docker://myhost.com/alpine:edge
sha256:31603596830fc7e56753139f9c2c6bd3759e48a850659506ebfb885d1cf3aef5 docker://myhost.com/postgres:14.3
```
2023-04-24 20:03:23 +02:00
**--preserve-digests**
Preserve the digests during copying. Fail if the digest cannot be preserved.
This option does not change what will be copied; consider using `--all` at the same time.
2021-12-03 16:02:40 +00:00
2018-07-09 15:27:01 +02:00
**--remove-signatures** Do not copy signatures, if any, from _ source-image _ . This is necessary when copying a signed image to a destination which does not support signatures.
2022-07-06 07:16:23 +02:00
**--sign-by** _ key-id _
2018-07-09 15:27:01 +02:00
2022-07-06 07:16:23 +02:00
Add a “simple signing” signature using that key ID for an image name corresponding to _ destination-image _
2023-01-11 21:42:03 +01:00
**--sign-by-sigstore** _ param-file _
Add a sigstore signature based on the options in the specified containers sigstore signing parameter file, _ param-file _ .
See containers-sigstore-signing-params.yaml(5) for details about the file format.
2022-07-06 07:16:23 +02:00
**--sign-by-sigstore-private-key** _ path _
Add a sigstore signature using a private key at _ path _ for an image name corresponding to _ destination-image _
2025-07-08 20:13:34 +02:00
**--sign-by-sq-fingerprint** _ fingerprint _
Add a “simple signing” signature using a Sequoia-PGP key with the specified _ fingerprint _ .
2022-07-06 07:16:23 +02:00
**--sign-passphrase-file** _ path _
2025-07-08 20:13:34 +02:00
The passphrase to use when signing with `--sign-by` , `--sign-by-sigstore-private-key` or `--sign-by-sq-fingerprint` .
Only the first line will be read. A passphrase stored in a file is of questionable security if other users can read this file. Do not use this option if at all avoidable.
2022-01-20 11:55:23 +01:00
2018-07-09 15:27:01 +02:00
**--src-creds** _ username[:password] _ for accessing the source registry.
**--dest-creds** _ username[:password] _ for accessing the destination registry.
**--src-cert-dir** _ path _ Use certificates (*.crt, * .cert, * .key) at _ path _ to connect to the source registry or daemon.
Improve the documentation of boolean flags
The Go behavior of boolean flags is as follows:
Accepted values are --flag, which is the same as --flag=true, and --flag=false,
which is the default (except for OptionalBoolFlag).
--flag {false,true} is parsed as --flag=true with a non-option {false,true} argument.
So, for almost all flags, document them just as --flag, not
mentioning the [={false,true}] part, because users can just
omit =true, or the whole flag instead of =false.
OTOH, for tls-verify, document only the tls-verify={true,false}
variant, because the primary use is tls-verify=false, and because
tls-verify is not "the default", but equivalent to an explicit
tls-verify=true (overriding registries.conf).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-31 23:50:46 +01:00
**--src-no-creds** Access the registry anonymously.
2018-07-09 15:27:01 +02:00
Improve the documentation of boolean flags
The Go behavior of boolean flags is as follows:
Accepted values are --flag, which is the same as --flag=true, and --flag=false,
which is the default (except for OptionalBoolFlag).
--flag {false,true} is parsed as --flag=true with a non-option {false,true} argument.
So, for almost all flags, document them just as --flag, not
mentioning the [={false,true}] part, because users can just
omit =true, or the whole flag instead of =false.
OTOH, for tls-verify, document only the tls-verify={true,false}
variant, because the primary use is tls-verify=false, and because
tls-verify is not "the default", but equivalent to an explicit
tls-verify=true (overriding registries.conf).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-31 23:50:46 +01:00
**--src-tls-verify**=_bool_ Require HTTPS and verify certificates when talking to a container source registry or daemon. Default to source registry entry in registry.conf setting.
2018-07-09 15:27:01 +02:00
**--dest-cert-dir** _ path _ Use certificates (*.crt, * .cert, * .key) at _ path _ to connect to the destination registry or daemon.
Improve the documentation of boolean flags
The Go behavior of boolean flags is as follows:
Accepted values are --flag, which is the same as --flag=true, and --flag=false,
which is the default (except for OptionalBoolFlag).
--flag {false,true} is parsed as --flag=true with a non-option {false,true} argument.
So, for almost all flags, document them just as --flag, not
mentioning the [={false,true}] part, because users can just
omit =true, or the whole flag instead of =false.
OTOH, for tls-verify, document only the tls-verify={true,false}
variant, because the primary use is tls-verify=false, and because
tls-verify is not "the default", but equivalent to an explicit
tls-verify=true (overriding registries.conf).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-31 23:50:46 +01:00
**--dest-no-creds** Access the registry anonymously.
2018-07-09 15:27:01 +02:00
Improve the documentation of boolean flags
The Go behavior of boolean flags is as follows:
Accepted values are --flag, which is the same as --flag=true, and --flag=false,
which is the default (except for OptionalBoolFlag).
--flag {false,true} is parsed as --flag=true with a non-option {false,true} argument.
So, for almost all flags, document them just as --flag, not
mentioning the [={false,true}] part, because users can just
omit =true, or the whole flag instead of =false.
OTOH, for tls-verify, document only the tls-verify={true,false}
variant, because the primary use is tls-verify=false, and because
tls-verify is not "the default", but equivalent to an explicit
tls-verify=true (overriding registries.conf).
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-01-31 23:50:46 +01:00
**--dest-tls-verify**=_bool_ Require HTTPS and verify certificates when talking to a container destination registry or daemon. Default to destination registry entry in registry.conf setting.
2018-07-09 15:27:01 +02:00
2020-09-18 18:11:01 +02:00
**--src-registry-token** _ Bearer token _ for accessing the source registry.
2020-09-18 11:40:51 +02:00
2020-09-18 18:11:01 +02:00
**--dest-registry-token** _ Bearer token _ for accessing the destination registry.
2020-09-18 11:40:51 +02:00
2025-01-16 16:15:39 -05:00
**--retry-times**
2026-01-07 16:15:13 +01:00
The number of times to retry. By default, no retries are attempted.
2025-01-16 16:15:39 -05:00
**--retry-delay**
Fixed delay between retries. If not set (or set to 0s), retry wait time will be exponentially increased based on the number of failed attempts.
2021-06-23 23:22:58 -04:00
2021-10-02 09:11:19 +05:30
**--keep-going**
If any errors occur during copying of images, those errors are logged and the process continues syncing rest of the images and finally fails at the end.
2021-10-04 10:36:44 +05:30
**--src-username**
The username to access the source registry.
**--src-password**
The password to access the source registry.
**--dest-username**
The username to access the destination registry.
**--dest-password**
The password to access the destination registry.
2018-07-09 15:27:01 +02:00
## EXAMPLES
### Synchronizing to a local directory
2023-01-25 17:07:06 +09:00
```console
2018-07-09 15:27:01 +02:00
$ skopeo sync --src docker --dest dir registry.example.com/busybox /media/usb
```
Images are located at:
```
/media/usb/busybox:1-glibc
/media/usb/busybox:1-musl
/media/usb/busybox:1-ubuntu
...
/media/usb/busybox:latest
```
2020-05-19 18:03:07 +08:00
### Synchronizing to a container registry from local
2020-05-22 01:03:12 +02:00
Images are located at:
2020-05-19 18:03:07 +08:00
```
2020-05-22 01:03:12 +02:00
/media/usb/busybox:1-glibc
2020-05-19 18:03:07 +08:00
```
Sync run
2023-01-25 17:07:06 +09:00
```console
2020-05-22 01:03:12 +02:00
$ skopeo sync --src dir --dest docker /media/usb/busybox:1-glibc my-registry.local.lan/test/
2020-05-19 18:03:07 +08:00
```
Destination registry content:
```
REPO TAGS
my-registry.local.lan/test/busybox 1-glibc
```
2018-07-09 15:27:01 +02:00
### Synchronizing to a local directory, scoped
2023-01-25 17:07:06 +09:00
```console
2018-07-09 15:27:01 +02:00
$ skopeo sync --src docker --dest dir --scoped registry.example.com/busybox /media/usb
```
Images are located at:
```
/media/usb/registry.example.com/busybox:1-glibc
/media/usb/registry.example.com/busybox:1-musl
/media/usb/registry.example.com/busybox:1-ubuntu
...
/media/usb/registry.example.com/busybox:latest
```
### Synchronizing to a container registry
2023-01-25 17:07:06 +09:00
```console
$ skopeo sync --src docker --dest docker registry.example.com/busybox my-registry.local.lan
2018-07-09 15:27:01 +02:00
```
Destination registry content:
```
2020-03-30 08:31:19 +02:00
REPO TAGS
registry.local.lan/busybox 1-glibc, 1-musl, 1-ubuntu, ..., latest
```
### Synchronizing to a container registry keeping the repository
2023-01-25 17:07:06 +09:00
```console
$ skopeo sync --src docker --dest docker registry.example.com/repo/busybox my-registry.local.lan/repo
2020-03-30 08:31:19 +02:00
```
Destination registry content:
```
REPO TAGS
registry.local.lan/repo/busybox 1-glibc, 1-musl, 1-ubuntu, ..., latest
2018-07-09 15:27:01 +02:00
```
2022-11-17 17:49:27 +00:00
### Synchronizing to a container registry with tag suffix
2023-01-25 17:07:06 +09:00
```console
$ skopeo sync --src docker --dest docker --append-suffix '-mirror' registry.example.com/busybox my-registry.local.lan
2022-11-17 17:49:27 +00:00
```
Destination registry content:
```
REPO TAGS
registry.local.lan/busybox 1-glibc-mirror, 1-musl-mirror, 1-ubuntu-mirror, ..., latest-mirror
```
2018-07-09 15:27:01 +02:00
### YAML file content (used _source_ for `**--src yaml**`)
```yaml
registry.example.com:
images:
busybox: []
redis:
- "1.0"
- "2.0"
2020-08-04 22:01:15 -06:00
- "sha256:0000000000000000000000000000000011111111111111111111111111111111"
2020-05-22 01:00:49 +02:00
images-by-tag-regex:
nginx: ^1\.13\.[12]-alpine-perl$
2024-01-04 10:45:27 +00:00
images-by-semver:
alpine: ">= 3.12.0"
2018-07-09 15:27:01 +02:00
credentials:
username: john
password: this is a secret
tls-verify: true
cert-dir: /home/john/certs
quay.io:
tls-verify: false
images:
coreos/etcd:
- latest
```
2020-05-19 18:03:07 +08:00
If the yaml filename is `sync.yml` , sync run:
2023-01-25 17:07:06 +09:00
```console
$ skopeo sync --src yaml --dest docker sync.yml my-registry.local.lan/repo/
2020-05-19 18:03:07 +08:00
```
2018-07-09 15:27:01 +02:00
This will copy the following images:
- Repository `registry.example.com/busybox` : all images, as no tags are specified.
2020-08-04 22:01:15 -06:00
- Repository `registry.example.com/redis` : images tagged "1.0" and "2.0" along with image with digest "sha256:0000000000000000000000000000000011111111111111111111111111111111".
2020-05-19 18:03:07 +08:00
- Repository `registry.example.com/nginx` : images tagged "1.13.1-alpine-perl" and "1.13.2-alpine-perl".
2018-07-09 15:27:01 +02:00
- Repository `quay.io/coreos/etcd` : images tagged "latest".
2024-01-04 10:45:27 +00:00
- Repository `registry.example.com/alpine` : all images with tags match the semantic version constraint ">= 3.12.0" ("3.12.0, "3.12.1", ... ,"4.0.0", ...)
The full list of possible semantic version comparisons can be found in the
upstream library's documentation:
https://github.com/Masterminds/semver/tree/v3.2.0#basic -comparisons.
Version ordering and precedence is understood as defined here:
https://semver.org/#spec -item-11.
2018-07-09 15:27:01 +02:00
For the registry `registry.example.com` , the "john"/"this is a secret" credentials are used, with server TLS certificates located at `/home/john/certs` .
2020-06-11 01:29:37 +08:00
TLS verification is normally enabled, and it can be disabled setting `tls-verify` to `false` .
2020-12-21 16:10:34 -05:00
In the above example, TLS verification is enabled for `registry.example.com` , while is
2018-07-09 15:27:01 +02:00
disabled for `quay.io` .
## SEE ALSO
2020-05-15 07:42:54 -04:00
skopeo(1), skopeo-login(1), docker-login(1), containers-auth.json(5), containers-policy.json(5), containers-transports(5)
2018-07-09 15:27:01 +02:00
## AUTHORS
Flavio Castelli <fcastelli@suse .com>, Marco Vedovati <mvedovati@suse .com>