본문 바로가기

리눅스

docker proxy 설정하는 방법(환경 변수 구성)

반응형

docker proxy 설정하는 방법(환경 변수 구성)

폐쇄망 인터넷망 비고
도커 데몬 프록시 서버  

테스트 환경

$ cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)

프록시 서버 지정하기 전에는 아래와 같이 타임아웃 발생

$ docker search ubuntu       
Error response from daemon: Get "https://index.docker.io/v1/search?q=ubuntu&n=25": dial tcp 52.1.184.176:443: i/o timeout

Configuring environment variables

1. /etc/systemd/system/docker.service.d 디렉토리 생성

mkdir /etc/systemd/system/docker.service.d

2. http-proxy.conf 파일 생성

vim /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://123.123.123.24:8080"
Environment="HTTPS_PROXY=http://123.123.123.24:8080"
Environment="NO_PROXY=localhost,127.0.0.1"

3. systemd 데몬 리로드

systemctl daemon-reload

4. 도커 데몬 재시작

systemctl restart docker

5. 구성이 로드되었는지 확인

systemctl show docker --property Environment
$ systemctl show docker --property Environment
Environment=HTTP_PROXY=http://123.123.123.24:8080 HTTPS_PROXY=http://123.123.123.24:8080 NO_PROXY=localhost,127.0.0.1
728x90

6. 도커 허브를 통한 도커 이미지 검색

$ docker search ubuntu                                  
NAME                             DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
ubuntu                           Ubuntu is a Debian-based Linux operating sys…   15933     [OK]       
websphere-liberty                WebSphere Liberty multi-architecture images …   293       [OK]       
open-liberty                     Open Liberty multi-architecture images based…   59        [OK]       
neurodebian                      NeuroDebian provides neuroscience research s…   99        [OK]       
ubuntu-debootstrap               DEPRECATED; use "ubuntu" instead                51        [OK]       
ubuntu-upstart                   DEPRECATED, as is Upstart (find other proces…   114       [OK]       
ubuntu/nginx                     Nginx, a high-performance reverse proxy & we…   89                   
ubuntu/cortex                    Cortex provides storage for Prometheus. Long…   3                    
ubuntu/squid                     Squid is a caching proxy for the Web. Long-t…   56                   
ubuntu/apache2                   Apache, a secure & extensible open-source HT…   58                   
ubuntu/mysql                     MySQL open source fast, stable, multi-thread…   46                   
ubuntu/kafka                     Apache Kafka, a distributed event streaming …   31                   
ubuntu/bind9                     BIND 9 is a very flexible, full-featured DNS…   51                   
ubuntu/redis                     Redis, an open source key-value store. Long-…   18                   
ubuntu/prometheus                Prometheus is a systems and service monitori…   40                   
ubuntu/postgres                  PostgreSQL is an open source object-relation…   27                   
ubuntu/zookeeper                 ZooKeeper maintains configuration informatio…   5                    
ubuntu/grafana                   Grafana, a feature rich metrics dashboard & …   9                    
ubuntu/memcached                 Memcached, in-memory keyvalue store for smal…   5                    
ubuntu/prometheus-alertmanager   Alertmanager handles client alerts from Prom…   8                    
ubuntu/dotnet-deps               Chiselled Ubuntu for self-contained .NET & A…   8                    
ubuntu/dotnet-runtime            Chiselled Ubuntu runtime image for .NET apps…   5                    
ubuntu/dotnet-aspnet             Chiselled Ubuntu runtime image for ASP.NET a…   6                    
ubuntu/cassandra                 Cassandra, an open source NoSQL distributed …   2                    
ubuntu/telegraf                  Telegraf collects, processes, aggregates & w…   4
$ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
dbf6a9befcde: Pull complete 
Digest: sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf
Status: Downloaded newer image for ubuntu:latest
docker.io/library/ubuntu:latest
$ docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
ubuntu       latest    3b418d7b466a   2 weeks ago   77.8MB

 

728x90
반응형