<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sergey Petrushin on Medium]]></title>
        <description><![CDATA[Stories by Sergey Petrushin on Medium]]></description>
        <link>https://medium.com/@s.petrushin?source=rss-f3e939a9b05c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gt3eU4UZNybL-6-4WBtmwQ.jpeg</url>
            <title>Stories by Sergey Petrushin on Medium</title>
            <link>https://medium.com/@s.petrushin?source=rss-f3e939a9b05c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:29:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@s.petrushin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Настройка GitLab Container Registry]]></title>
            <link>https://medium.com/@s.petrushin/%D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B0-gitlab-container-registry-c9ae3fb8a35?source=rss-f3e939a9b05c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9ae3fb8a35</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[registry]]></category>
            <dc:creator><![CDATA[Sergey Petrushin]]></dc:creator>
            <pubDate>Fri, 22 Jun 2018 13:00:36 GMT</pubDate>
            <atom:updated>2021-04-27T18:13:31.214Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*CzQ6p9YhZ460a2Dv8kX0Iw.png" /></figure><h3>На начало 2021 года статья утратила актуальность в связи с тем, что поддержка Package Registry есть и работает из коробки в свежих версиях GitLab.</h3><p>Задача: настроить и опубликовать GitLab Container Registry для доступа через reverse-proxy</p><p><strong>Вводные данные:</strong></p><ol><li>У нас уже есть установленный с помощью <em>omnibus </em>пакета <em>GitLab</em></li><li>ОС у нас <em>Ubuntu</em></li><li>Реестр будет находиться по адресу <em>registry.domain.com</em></li></ol><p><strong>Решение:</strong></p><ol><li>Получаем LE сертификат (предполагаем что у нас уже стоит <em>certbot</em>):</li></ol><pre>sudo certbot certonly - webroot - email <a href="/service/mailto:sysadmins@domain.com">sysadmins@domain.com</a> -w /var/www/letsencrypt - expand -d registry.domain.com</pre><p>2. Создаем конфигурацию для NGINX registry.domain.conf в /etc/nginx/conf.d (GitLab берет отсюда любые конфигурации и добавляет их к встроенному NGINX:</p><pre>server {<br>  listen 80;<br>  server_name registry.domain.com;<br>  access_log logs/registry.domain.access.log;</pre><pre>location / {<br>        return 301 <a href="https://registry.green-light.com$request_uri/">https://registry.domain.com$request_uri</a>;<br>    }</pre><pre>location ^~ /.well-known {<br>        root /var/www/letsencrypt;<br>    }</pre><pre>}<br>server {<br>    listen 443 ssl;<br>    server_name registry.domain.com;<br>    root /var/www;</pre><pre>ssl on;</pre><pre><br>    ssl_certificate /etc/letsencrypt/live/registry.domain.com/fullchain.pem;<br>    ssl_certificate_key /etc/letsencrypt/live/registry.domain.com/privkey.pem;</pre><pre>    ssl_session_cache shared:SSL:10m;<br>    ssl_session_timeout 10m;<br>    ssl_prefer_server_ciphers on;<br>    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<br>    ssl_ciphers &#39;ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:E$</pre><pre>    client_max_body_size 0;<br>    chunked_transfer_encoding on;</pre><pre>   add_header Strict-Transport-Security &quot;max- age=31536000;includeSubDomains&quot;;<br>    add_header X-Frame-Options DENY;<br>    add_header X-Content-Type-Options nosniff;</pre><pre>location / {<br>        proxy_pass <a href="http://127.0.0.1:8081/">http://127.0.0.1:8081</a>;<br>        proxy_set_header Host $http_host;   # required for docker client&#39;s sake<br>        proxy_set_header X-Real-IP $remote_addr; # pass on real client&#39;s IP<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>        proxy_read_timeout 900;<br>        proxy_buffering on;<br>    }<br>}</pre><p>3. Редактируем следующие параметры в конфигурации GitLab:</p><ul><li>Внешний URL</li></ul><pre>registry_external_url &#39;<a href="https://registry.green-light.com&/#39;">https://registry.domain.com&#39;</a></pre><ul><li>Настройки реестра (в моем случае реестр работает не на стандартном порту 5000 внутри сервера)</li></ul><pre>gitlab_rails[&#39;registry_enabled&#39;] = false<br>gitlab_rails[&#39;registry_host&#39;] = &quot;registry.domain.com&quot;<br>gitlab_rails[&#39;registry_path&#39;] = &quot;/var/big-data/gitlab-registry&quot;<br>gitlab_rails[&#39;registry_api_url&#39;] = &quot;<a href="http://localhost:5050/">http://localhost:5050</a>&quot;</pre><pre>registry[&#39;enable&#39;] = true<br>registry[&#39;registry_http_addr&#39;] = &quot;localhost:5050&quot;<br>registry[&#39;debug_addr&#39;] = &quot;localhost:5051&quot;</pre><ul><li>Настройка проксирования реестра (NGINX использует порт 8081 для доступа к реестру)</li></ul><pre>registry_nginx[&#39;enable&#39;] = true<br>registry_nginx[&#39;listen_port&#39;] = 8081<br>registry_nginx[&#39;listen_https&#39;] = false<br>registry_nginx[&#39;proxy_set_headers&#39;] = {<br>  &quot;Host&quot; =&gt; &quot;$http_host&quot;,<br>  &quot;X-Real-IP&quot; =&gt; &quot;$remote_addr&quot;,<br>  &quot;X-Forwarded-For&quot; =&gt; &quot;$proxy_add_x_forwarded_for&quot;,<br>  &quot;X-Forwarded-Proto&quot; =&gt; &quot;https&quot;,<br>  &quot;X-Forwarded-Ssl&quot; =&gt; &quot;on&quot;<br> }</pre><ul><li>Запускаем перенастройку GitLab:</li></ul><pre>sudo gitlab-ctl reconfigure</pre><p>4. Проверяем что в свойствах проекта появилась вкладка Registry:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/1*RcPqxOigIo_OWj21Nu-JzA.png" /></figure><p>5. Проверяем что мы можем залогиниться и залить наш образ:</p><pre>docker login registry.domain.com</pre><pre>docker build -t registry.domain.com/test/test-1 .<br>docker push registry.domain.com/test/test-1</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9ae3fb8a35" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>