Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用release-ci.Dockerfile构建镜像失败 #75

Closed
oceanqdu opened this issue Jul 23, 2024 · 1 comment
Closed

使用release-ci.Dockerfile构建镜像失败 #75

oceanqdu opened this issue Jul 23, 2024 · 1 comment

Comments

@oceanqdu
Copy link

oceanqdu commented Jul 23, 2024

在x86的机器上希望使用构造一个amd64的编译镜像,我使用了在shell脚本里使用了以下命令

docker buildx build --platform="linux/amd64" --tag "${CI_IMAGE_NAME}_${PLATFORM}:${CI_IMAGE_TAG}" -f release-ci.Dockerfile --load .

其中release-ci.Dockerfile使用本仓库中对应的release-ci.Dockerfile https://github.com/secretflow/devtools/blob/main/dockerfiles/release-ci.DockerFile
构建过程中发生以下错误:

=> ERROR [2/9] RUN yum install -y centos-release-scl epel-release     && yum update -y     2.0s
------
 > [2/9] RUN yum install -y centos-release-scl epel-release     && yum update -y     && yum clean all:
0.690 Loaded plugins: fastestmirror, ovl
1.410 Determining fastest mirrors
1.472 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
1.472 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
1.477 
1.477 
1.477  One of the configured repositories failed (Unknown),
1.477  and yum doesn't have enough cached data to continue. At this point the only
1.477  safe thing yum can do is fail. There are a few ways to work "fix" this:
1.477 
1.477      1. Contact the upstream for the repository and get them to fix the problem.
1.477 
1.477      2. Reconfigure the baseurl/etc. for the repository, to point to a working
1.477         upstream. This is most often useful if you are using a newer
1.477         distribution release than is supported by the repository (and the
1.477         packages for the previous distribution release still work).
1.477 
1.477      3. Run the command with the repository temporarily disabled
1.477             yum --disablerepo=<repoid> ...
1.477 
1.477      4. Disable the repository permanently, so yum won't use it by default. Yum
1.477         will then just ignore the repository until you permanently enable it
1.477         again or use --enablerepo for temporary usage:
1.477 
1.477             yum-config-manager --disable <repoid>
1.477         or
1.477             subscription-manager repos --disable=<repoid>
1.477 
1.477      5. Configure the failing repository to be skipped, if it is unavailable.
1.477         Note that yum will try to contact the repo. when it runs most commands,
1.477         so will have to try and fail each time (and thus. yum will be be much
1.477         slower). If it is a very temporary problem though, this is often a nice
1.477         compromise:
1.477 
1.477             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
1.477 
1.477 Cannot find a valid baseurl for repo: base/7/x86_64
------
release-ci.Dockerfile:3
--------------------
   2 |     
   3 | >>> RUN yum install -y centos-release-scl epel-release \
   4 | >>>     && yum update -y \
   5 | >>>     && yum clean all
   6 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c yum install -y centos-release-scl epel-release     && yum update -y     && yum clean all" did not complete successfully: exit code: 1

而使用 https://github.com/secretflow/devtools/blob/main/dockerfiles/release-ci-aarch64.DockerFile
构造arm64的镜像是能够成功构建没有问题的,
同时我修改了 release-ci.Dockerfile中的基础镜像,https://github.com/secretflow/devtools/blob/main/dockerfiles/release-ci.DockerFile#L1-L5
修改为以下内容:

FROM centos:centos8

RUN cd /etc/yum.repos.d/ \
    && sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* \
    && sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* \
    && yum update -y \
    && yum install -y dnf-plugins-core \
    && yum config-manager --set-enabled powertools \
    && yum clean all

则能够成功构建基于amd64架构的镜像。
请问我这里使用centos8作为基础系统镜像是否会存在问题?

@oceanqdu
Copy link
Author

oceanqdu commented Jul 23, 2024

#77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants