Home >Operation and Maintenance >Docker >How docker accesses the Internet through a proxy

How docker accesses the Internet through a proxy

王林
王林Original
2020-05-20 10:28:323770browse

How docker accesses the Internet through a proxy

You need to add an Internet proxy in the docker configuration file.

The specific method is as follows:

1. Edit /usr/lib/systemd/system/docker.service and add the following two paragraphs

# vim /usr/lib/systemd/system/docker.service 
......
Environment="HTTP_PROXY=代理url"        < 追加
Environment="HTTPS_PROXY=代理url"      < 追加
......

2. Restart docker.service Service

# systemctl daemon-reload
# systemctl restart docker.service

3. Finally test whether docker can connect to the Internet

# docker run -it openshift/hello-openshift

Recommended tutorial: docker tutorial

The above is the detailed content of How docker accesses the Internet through a proxy. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn