Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
781 views
in Technique[技术] by (71.8m points)

docker - Centos -- Yum Update Error – “HTTP Error 403 - Forbidden”

I’ve recently spun up a Docker container running CentOS Linux version 7. In my office, we have a proxy server, so once the container was up, I consoled in and set the proxy manually:

[me@8adfa83bb9e2 /home/me]#
[me@8adfa83bb9e2 /home/me]# export http_proxy="http://10.10.10.101:8888"
[me@8adfa83bb9e2 /home/me]#

On a separate SO post, I learned about setting the proxy in the /etc/yum.conf file. So I added the following line to my /etc/yum.conf file:

proxy=http://10.10.10.101:8888

And then I did a “yum clean metadata”:

[me@8adfa83bb9e2 /home/me]# yum clean metadata
Loaded plugins: fastestmirror, ovl
Cleaning repos: base extras updates
0 metadata files removed
0 sqlite files removed
0 metadata files removed
[me@8adfa83bb9e2 /home/me]#

At this point, I figured I was home free. I did a “yum update”:

[me@8adfa83bb9e2 /home/me]#
[me@8adfa83bb9e2 /home/me]# yum update
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: HTTP Error 403 – Forbidden
...and then a lot more stuff here...

Hmm. “HTTP Error 403”. That’s a new one for me; I’m used to running “yum update” and it just automagically works.

This isn’t a DNS problem; the Docker container can resolve and ping mirrorlist.centos.org. I tried to use wget to pull down that URL, but the container doesn’t have wget installed. When I try the same thing from the host machine:

me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ sudo wget http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container
[1] 7039
[2] 7040
[3] 7041
[2]   Done                    arch=x86_64
me@hostmachine:/home/me$
Redirecting output to ‘wget-log’.

[1]-  Exit 8                  sudo wget http://mirrorlist.centos.org/?release=7
[3]+  Done                    repo=os
me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ ls -l
total 4
-rw-r--r-- 1 root root 382 Jan 21 19:55 wget-log
me@hostmachine:/home/me$
me@hostmachine:/home/me$
me@hostmachine:/home/me$ more wget-log
--2021-01-21 19:55:31--  http://mirrorlist.centos.org/?release=7
Resolving mirrorlist.centos.org (mirrorlist.centos.org)... 147.75.69.225, 18.225.36.18, 67.219.148.138, ...
Connecting to mirrorlist.centos.org (mirrorlist.centos.org)|147.75.69.225|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2021-01-21 19:55:31 ERROR 503: Service Unavailable.

me@hostmachine:/home/me$
me@hostmachine:/home/me$

(Yes, the host machine has the correct proxy settings. It is not a Centos machine.)

Soooooooo… It looks like the yum service is “unavailable” from my host system. But I’ve run “yum update” on many, many other Centos machines in my environment. No idea what might be different here. Has anyone seen this before? Thank you.

question from:https://stackoverflow.com/questions/65835145/centos-yum-update-error-http-error-403-forbidden

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

FYI for anyone who may be looking at this post... The issue was a proxy server problem. Once I set the proxy server settings on both the host and container, the issue went away. I think in the above post, I'd set the proxy on the container, but not the host, and the host was NAT'ing the container's IP address when doing a "yum update."


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...