# 如何配置docker使用HTTP代理 | David Young Blog
如何配置docker使用HTTP代理

## Ubuntu

### 设置docker使用http proxy

    sudo /etc/default/docker

    export http_proxy="http://127.0.0.1:3128/"
    export https_proxy="http://127.0.0.1:3128/"
    export HTTP_PROXY="http://127.0.0.1:3128/"
    export HTTPS_PROXY="http://127.0.0.1:3128/"

### 加载配置并重启docker

    sudo service docker restart

## CentOS

### 设置docker使用http proxy

    sudo mkdir -p /etc/systemd/system/docker.service.d

    echo '
    [Service]
    Environment="HTTP_PROXY=http://proxy.foo.bar.com:80/"
    ' | sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf

### 加载配置并重启docker

    sudo systemctl daemon-reload
    sudo systemctl restart docker

「真诚赞赏，手留余香」

David Young

真诚赞赏，手留余香

使用微信扫描二维码完成支付

- ← Previous Post
- Next Post →

##### CATALOG

##### FEATURED TAGS

docker istio kubernetes microservice security service mesh tips

##### FRIENDS

- Linda的博客