我的Dockerfile

FROM centos:7

# Install Apache
RUN yum -y update
RUN yum -y install httpd httpd-tools

# Install EPEL Repo
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

# Install PHP
RUN yum install yum-utils
RUN yum-config-manager --enable remi-php73

RUN yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

# Update Apache Configuration
RUN sed -E -i -e '/<Directory "\/var\/www\/html">/,/<\/Directory>/s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
RUN sed -E -i -e 's/DirectoryIndex (.*)$/DirectoryIndex index.php \1/g' /etc/httpd/conf/httpd.conf

EXPOSE 80

# Start Apache
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
当我想要建立这张图片时,我得到
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm]: runc did not terminate successfully
如何使用centos apache和PHP 73构建docker镜像?

最佳答案

删除三行

# Install EPEL Repo
RUN yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
这些命令不存在,我怀疑您试图复制dnf的指令,并用dnf替换了yum,但无法正常工作。
而且无论如何您都不需要那些。
如果确实需要它们,可以尝试
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
或许
RUN yum -y update; \
    yum install -y epel-release; \
    rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

关于docker - 无法使用前端dockerfile.v0解决:无法构建LLB:执行程序失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/64621602/

10-16 21:52