How to configure proxy to solve the problem that docker pull command cannot pull the image
This article was last updated 240 days ago. The information in this article may have developed or changed. If it is invalid, please leave a message in the comment section.

At present, Docker pull in China cannot be used normally, and several commonly used domestic mirror sites have stopped service. If there is no available proxy, I don’t know how to access it. . .
image.png

However, for friends who have a proxy, you can use the following method to solve the problem that docker pull cannot pull the image:

mkdir -p /etc/systemd/system/docker.service.d vim /etc/systemd/system/docker.service.d/proxy.conf

Use vim to add the following content to the newly created proxy.conf and save it. Assume that 100.100.100.100 is your proxy server address and 58880 is the proxy server port:

[Service] Environment="HTTP_PROXY=http://100.100.100.100:58880/" Environment="HTTPS_PROXY=http://100.100.100.100:58880/" Environment="NO_PROXY=localhost,127.0.0.1"

Then restart the systemd and docker services:

systemctl daemon-reload systemctl restart docker

At this time, use the following command to view:

systemctl show --property=Environment docker

image.png

You can see that the docker environment has used the proxy we configured, and then perform docker pull:

image.png

It can be used normally now.

Another: It is a bit strange that usingproxychains docker pullThe method does not work properly. It is clearly pointing to a proxy. This makes me a little confused. In the past, when the pull was slow, I used proxychains directly. . . I'll leave a mark here and study it when I'm in the mood.

The content of the blog is original. Please indicate the source when reprinting! For more blog articles, you can go toSitemapUnderstand. The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if necessary, you can joinTelegram GroupDiscuss the problem together.

Comments

  1. wbuntu
    Macintosh Chrome 127.0.0.0
    6 months ago
    2024-8-13 23:53:23

    I built a mirror locally using the registry, and then configured the mirror with a proxy to access dockerhub. If you build or pull images frequently, you can also use the cache.

    • Owner
      wbuntu
      Macintosh Chrome 127.0.0.0
      6 months ago
      2024-8-15 10:14:47

      It is also possible. I don't pull images very often now, I just use them occasionally, so there is no need to bother with it. Now because of the cache, if I don't log in directly to the local backend of WordPress, I can't see the comments. I feel that it is very strange that no one has commented during this period. Today, I directly logged in to the local backend and found a lot of comments.

  2. 111
    Linux Edge 127.0.0.0
    6 months ago
    2024-8-12 21:03:30

    Thank you, I'm a novice who just came into contact with docker, so you gave me a big

    • Owner
      111
      Macintosh Chrome 127.0.0.0
      6 months ago
      2024-8-15 10:15:23

      You're welcome. As long as it's useful, that's good. However, this method has its own threshold and requires scientific ability.

  3. There is ice in the bamboo forest
    Linux Firefox 128.0
    7 months ago
    2024-6-30 4:37:27

    proxychains docker pull It is normal that it cannot be used. 1 TP4Tbddocker pull This action is actually performed by dockerd started by systemd, and docker itself only sends the pull command to dockerd. It is meaningless to proxy the docker controller. You have to find a way to proxy the dockerd that actually performs the operation. Dockerd has already been running by systemd before you execute the docker pull command. At this time, it is not only too late to use proxychains, but also the object that really needs to be proxied is wrong.

    • Owner
      There is ice in the bamboo forest
      Macintosh Chrome 126.0.0.0
      7 months ago
      2024-6-30 10:10:10

      Thanks for the answer, which saved me the time of studying again. It seems that I am still too rough about the details of the internal workings of Docker, and only stay at the level of basic usage. I will study it in depth in the future.

  4. jjxx
    Windows Edge 125.0.0.0
    8 months ago
    2024-6-13 15:43:57

    That's awesome, bro.

    • Owner
      jjxx
      Macintosh Chrome 125.0.0.0
      8 months ago
      2024-6-13 15:46:34

      This is not great, there are tutorials everywhere on the Internet~~Many of my other articles are great. .

  5. Windows Edge 125.0.0.0
    8 months ago
    2024-6-10 10:31:02

    On-premises direct gateway proxy.

    • Owner
      Netizen Xiao Song
      Macintosh Chrome 125.0.0.0
      8 months ago
      2024-6-10 10:40:41

      This is written for scenarios (or people) where there is no gateway proxy but only a general proxy, such as a cloud server. Of course, it is not needed locally, and I don’t feel it.

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠(ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ°Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Emoticons
Emoji
Little Dinosaur
flower!
Previous
Next
       
error:
en_US
Spring Festival
hapiness