Creating a mirror
The basic command for creating a mirror is:Your mirror type must match the source repository. For example, if your source mirror contains conda packages, you must use
conda as your mirror type.Creating a mirror with a policy
When you create or edit a mirror on a channel that has a policy, the channel’s policy is automatically applied. To assign a specific policy to the mirror instead, include--use-channel-policy False and --policy-id <POLICY_ID>:
Filtering mirrored packages
Adding filters to your mirrors ensures you only mirror the packages you need. You can filter by platform, license, specific packages, CVE score, and date range. For more information about CVEs, see Common Vulnerabilities and Exposures (CVEs).Filters can also be applied at the channel level. Both the channel filter and the mirror filter are applied. The mirror filter restricts packages pulled from the source mirror, and the channel filter restricts which packages are allowed into the channel. Filters should not contain configurations that conflict with one another.
Platform filtering
--subdirs: Instruct Package Security Manager to only mirror packages for the provided subdirectories. Anaconda recommends you always include the noarch platform as well as the specific platform architectures necessary for your organization. Use a comma-separated string in double quotes:
noarch, linux-32, linux-64, linux-aarch64, linux-armv6l, linux-armv7l, linux-ppc64, linux-ppc64le, osx-64, osx-arm64, win-32, win-64, zos-z
If your source mirror does not contain conda packages, this argument is not necessary.
Mirror type
--type: Denotes the mirror type. Possible types are conda, python_simple, and CRAN:
PyPI project filtering
--projects: List of PyPI projects to mirror. Use a comma-separated string in double quotes:
License filtering
--licenses: Include or exclude licenses. To exclude a license, prepend the entry with a hyphen (-). Use a comma-separated string in double quotes:
agpl, gpl2, gpl3, lgpl, bsd, mit, apache, psf, public_domain, proprietary, other, none
Package filtering
--only_spec: Include a specific package from the source mirror. Uses MatchSpec to specify the package. Supply this argument multiple times for multiple entries.
For more information about MatchSpec queries, see Package match specifications.
--exclude_spec: Exclude a package from the source mirror. Supply this argument multiple times for multiple entries:
--include_spec: Include a package (or a specific version) that would otherwise be excluded by --exclude_spec. Supply this argument multiple times for multiple entries:
CVE filtering
--cve_score: Remove all files associated with a CVE that has a score equal to or higher than the threshold value. CVE scores range from 0–10 and can contain up to one decimal point:
--exclude_uncurated_cve_packages: Remove all files associated with uncurated CVEs. This argument takes no value:
Package Security Manager 6.8.0 doesn’t support
--exclude_uncurated_cve_packages for conda mirrors. The mirror is created, but the filter is ignored. To exclude uncurated CVE packages, use the --exclude-uncurated-cve-packages option in a policy.Date filtering
--date_from: Start of a date range for when a conda package was published. Format: YYYY-MM-DD.
--date_to: End of a date range for when a conda package was published. Format: YYYY-MM-DD.
A maximum span of one year is allowed between the start and end of the date range.
Viewing mirror status
To view the status of a mirror:Stopping and restarting a mirror
To stop an in-progress mirror:Updating a mirror
To update an existing mirror, use the--update argument with the same mirror arguments used during creation:
If you do not include the
--run_now argument, your mirror updates on its next scheduled run. Run conda repo mirror --update <MIRROR_NAME> --channel <CHANNEL_NAME> --run_now to trigger an immediate update without changing any parameters.Deleting a mirror
To delete a mirror:When you create a conda mirror with filter arguments, Package Security Manager also creates a policy named
<MIRROR_NAME>_<ID>. Deleting the mirror doesn’t delete this policy. To remove it, find its ID with conda repo policy --list-all, and then run conda repo policy --delete <POLICY_ID>.Related
- Mirrors: Managing mirrors through the GUI
- Policies: Creating and managing security policies
mirrorcommand reference: Full options and flags