debian-mirror-gitlab/doc/user/packages/dependency_proxy/index.md

92 lines
3.4 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
stage: Package
group: Package
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
2021-01-29 00:20:46 +05:30
# Dependency Proxy
2019-12-04 20:38:33 +05:30
2021-01-29 00:20:46 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7934) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.11.
> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/273655) to [GitLab Core](https://about.gitlab.com/pricing/) in GitLab 13.6.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
The GitLab Dependency Proxy is a local proxy you can use for your frequently-accessed
upstream images.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
In the case of CI/CD, the Dependency Proxy receives a request and returns the
upstream image from a registry, acting as a pull-through cache.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
## Prerequisites
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
To use the Dependency Proxy:
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
- Your group must be public. Authentication for private groups is [not supported yet](https://gitlab.com/gitlab-org/gitlab/-/issues/11582).
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
### Supported images and packages
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
The following images and packages are supported.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
| Image/Package | GitLab version |
2019-12-04 20:38:33 +05:30
| ---------------- | -------------- |
| Docker | 11.11+ |
2021-01-03 14:25:43 +05:30
For a list of planned additions, view the
[direction page](https://about.gitlab.com/direction/package/dependency_proxy/#top-vision-items).
## View the Dependency Proxy
To view the Dependency Proxy:
- Go to your group's **Packages & Registries > Dependency Proxy**.
The Dependency Proxy is not available for projects.
## Use the Dependency Proxy for Docker images
2021-01-29 00:20:46 +05:30
CAUTION: **Important:**
In some specific storage configurations, an issue occurs and container images are not pulled correctly from the cache. The problem occurs when an image is located in object storage. The proxy looks for it locally and fails to find it. View [issue #208080](https://gitlab.com/gitlab-org/gitlab/-/issues/208080) for details.
2021-01-03 14:25:43 +05:30
You can use GitLab as a source for your Docker images.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
Prerequisites:
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
- Your images must be stored on [Docker Hub](https://hub.docker.com/).
- Docker Hub must be available. Follow [this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/241639)
for progress on accessing images when Docker Hub is down.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
To store a Docker image in Dependency Proxy storage:
1. Go to your group's **Packages & Registries > Dependency Proxy**.
1. Copy the **Dependency Proxy URL**.
1. Use one of these commands. In these examples, the image is `alpine:latest`.
- Add the URL to your [`.gitlab-ci.yml`](../../../ci/yaml/README.md#image) file:
2019-12-04 20:38:33 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-01-03 14:25:43 +05:30
image: gitlab.example.com/groupname/dependency_proxy/containers/alpine:latest
2019-12-04 20:38:33 +05:30
```
2021-01-03 14:25:43 +05:30
- Manually pull the Docker image:
2019-12-04 20:38:33 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-01-03 14:25:43 +05:30
docker pull gitlab.example.com/groupname/dependency_proxy/containers/alpine:latest
2019-12-04 20:38:33 +05:30
```
2021-01-03 14:25:43 +05:30
- Add the URL to a `Dockerfile`:
2019-12-04 20:38:33 +05:30
2020-03-13 15:44:24 +05:30
```shell
2021-01-03 14:25:43 +05:30
FROM gitlab.example.com/groupname/dependency_proxy/containers/alpine:latest
2019-12-04 20:38:33 +05:30
```
2020-10-24 23:57:45 +05:30
GitLab pulls the Docker image from Docker Hub and caches the blobs
on the GitLab server. The next time you pull the same image, GitLab gets the latest
2021-01-03 14:25:43 +05:30
information about the image from Docker Hub, but serves the existing blobs
2020-10-24 23:57:45 +05:30
from the GitLab server.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
## Clear the Dependency Proxy cache
2020-04-22 19:07:51 +05:30
2021-01-03 14:25:43 +05:30
Blobs are kept forever on the GitLab server, and there is no hard limit on how much data can be
stored.
2019-12-04 20:38:33 +05:30
2021-01-03 14:25:43 +05:30
To reclaim disk space used by image blobs that are no longer needed, use
the [Dependency Proxy API](../../../api/dependency_proxy.md).