In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Execute yum in dockerfile or in container, error is reported, no source (invalid baseurl xxx) can be found, but it is OK to execute yum on host machine. Why?
Because whether dockerfile executes yum using the RUN keyword or goes directly to the container to execute yum, they are all sources in the docker image used (CentOS is in the path / etc/yum.repo.d/CentOS-Base.repo), so you need to copy the source under the same path on the host to the container, and then docker commit a new "basic image". In this case, using docker build xxx (that is, using Dockerfile) will not cause an error.
Copy method docker cp xxx xxx
Content expansion
Error report when performing yum operation in dockerfile
Let's take a look at the error message first:
Sending build context to Docker daemon 9.363 MB
Step 1: FROM docker.io/centos
-- > 196e0ce0c9fb
Step 2: MAINTAINER liuliangliang
-- > Using cache
-- > 7d7e06799c20
Step 3: ADD file/tomcat7.tgz / usr/local/
-- > Using cache
-- > 10ffdea53a02
Step 4: RUN yum install java-1.8.0-openjdk-y
-- > Running in 7824a339e077
Loaded plugins: fastestmirror, ovl
One of the configured repositories failed (Unknown)
And yum doesn't have enough cached data to continue. At this point the only
Safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. For the repository, to point to a working
Upstream. This is most often useful if you are using a newer
Distribution release than is supported by the repository (and the
Packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
Yum-- disablerepo=...
4. Disable the repository permanently, so yum won't use it by default. Yum
Will then just ignore the repository until you permanently enable it
Again or use-enablerepo for temporary usage:
Yum-config-manager-disable
Or
Subscription-manager repos-disable=
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. When it runs most commands
So will have to try and fail each time (and thus. Yum will be be much
Slower). If it is a very temporary problem though, this is often a nice
Compromise:
Yum-config-manager-save-setopt=.skip_if_unavailable=true
Cannot find a valid baseurl for repo: base/7/x86_64
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#6-"Could not resolve host: mirrorlist.centos.org; Unknown error"
The command'/ bin/sh-c yum install java-1.8.0-openjdk-y 'returned a non-zero code: 1
Solution:
You can just add the DNS service to the resolv.conf file, which is under / etc, plus
Nameserver 8.8.8.8
Nameserver 8.8.4.4
Search localdomain
That's it.
This is the end of this article on the solution of docker container calling yum error report, more related docker container call yum error report how to solve the content, please search the previous article or continue to browse the following related article hope that you will support it in the future!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.