Home >Operation and Maintenance >Docker >How to solve the error when docker container calls yum

How to solve the error when docker container calls yum

尚
Original
2020-03-25 13:32:502144browse

How to solve the error when docker container calls yum

When executing yum in the 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. Why?

Because whether the 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 need to copy the source under the same path on the host 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 An error will be reported.

Copy method docker cp xxx xxx

For more related tutorials, please pay attention to the docker tutorial column on the PHP Chinese website.

The above is the detailed content of How to solve the error when docker container calls yum. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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