When executing yum in dockerfile or in the container, an error is reported and the source cannot be found (invalid baseurl xxx), but there is no problem executing yum on the host machine. Why? Because no matter whether Dockerfile uses the RUN keyword to execute yum or directly enters the container to execute yum, they all use the source in the Docker image (CentOS is in the path /etc/yum.repo.d/CentOS-Base.repo), so you have to copy the source in the same path on the host machine to the container, and then docker commit a new "base image". At this time, using docker build xxx (that is, using the Dockerfile method) will not report an error. Copy method: docker cp xxx xxx Content Extension Error when executing yum operation in dockerfile Let’s first look at the error message:
Solution: You just need to add the DNS service to the resolv.conf file. This file is in /etc. Add
That's it This is the end of this article about how to solve the error when calling yum from a docker container. For more information about how to solve the error when calling yum from a docker container, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Pure JavaScript to implement the number guessing game
>>: MySQL uses custom functions to recursively query parent ID or child ID
When mysql is running normally, it is not difficu...
Table of contents 1 The common rules for creating...
Install Enter the following command to install it...
Table of contents 1. Download MySQL 2. Install My...
This article mainly introduces the case of Vue en...
The specific code for implementing skinning with ...
background A few days ago, when I was doing pagin...
This article shares with you how to use canvas an...
Table of contents Difference between char and var...
Table of contents Effect demonstration:Main JS co...
Introduction This article records how to mount a ...
1. SSH remote management SSH Definition SSH (Secu...
Table of contents 1. Live broadcast effect 2. Ste...
Before learning awk, we should have learned sed, ...
background Not long ago, I made a function about ...