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

How docker accesses the Internet through a proxy

王林
Release: 2020-05-20 10:28:32
Original
3758 people have browsed it

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"      < 追加
......
Copy after login

2. Restart docker.service Service

# systemctl daemon-reload
# systemctl restart docker.service
Copy after login

3. Finally test whether docker can connect to the Internet

# docker run -it openshift/hello-openshift
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template