带有 M1 芯片的 Mac Studio 上的 Dockerfile 无法运行 apt-get 命令

问题描述 投票:0回答:0

下面是我的 Dockerfile。该文件在一位同事的 Windows 计算机以及另一位运行 Ventura 的 Mac Studio 上成功构建(就像我一样,除了它有一个 M2 芯片,而我有一个 M1 芯片)。这是为了支持 Magento 1.9.x 安装,所以如果有人知道在带有 M1 芯片的 MacOS 上的一个好的 docker 设置,请告诉我!

错误:

failed to solve: process "/bin/sh -c apt-get -y update" did not complete successfully: exit code: 100
.

此外,它会收到 404 错误,但是同样的 Dockerfile 是在我同事的计算机上构建的。

Dockerfile:

FROM --platform=linux/amd64 php:5.6-apache

ENV XDEBUG_PORT 9000

# Install System Dependencies

RUN apt-get -y update #errors out here, let alone the next one!

RUN apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
    software-properties-common \
    && apt-get update \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    nodejs \
    libfreetype6-dev \
    libicu-dev \
    libssl-dev \
    libjpeg62-turbo-dev \
    libmcrypt-dev \
    libedit-dev \
    libedit2 \
    libxslt1-dev \
    libzip-dev \
    apt-utils \
    gnupg \
    redis-tools \
    mariadb-client \
    git \
    vim \
    wget \
    curl \
    lynx \
    psmisc \
    unzip \
    tar \
    cron \
    rsync \
    bash-completion \
    && apt-get clean

# Install Magento Dependencies

RUN docker-php-ext-configure \
    gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
    docker-php-ext-install \
    opcache \
    gd \
    bcmath \
    intl \
    mbstring \
    pdo_mysql \
    soap \
    xsl \
    zip \
    sockets


RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli

RUN apt-get install -y apt-transport-https

# Install Node, NVM, NPM and Gulp

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
    && apt-get install -y nodejs build-essential \
    && npm i -g gulp yarn

# Install Composer

# Install Ruby and Compass

# Getting the rvm necessary data via url protocol.
RUN apt-get install -y ruby-dev

RUN ruby -v

# Finally install compass.
RUN gem install compass

RUN curl -sS https://getcomposer.org/installer | php -- --version=1.10.17 --install-dir=/usr/local/bin/ --filename=composer

# Install Code Sniffer

RUN git clone https://github.com/magento/marketplace-eqp.git ~/.composer/vendor/magento/marketplace-eqp
RUN cd ~/.composer/vendor/magento/marketplace-eqp && composer install
RUN ln -s ~/.composer/vendor/magento/marketplace-eqp/vendor/bin/phpcs /usr/local/bin;

ENV PATH="/var/www/.composer/vendor/bin/:${PATH}"


RUN git clone -b XDEBUG_2_5_5 https://github.com/xdebug/xdebug.git /root/xdebug \
&& cd /root/xdebug && ./rebuild.sh 

# Install Mhsendmail

RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang-go \
   && mkdir /opt/go \
   && export GOPATH=/opt/go \
   && go get github.com/mailhog/mhsendmail

# Install Magerun 1

RUN wget https://files.magerun.net/n98-magerun-1.97.15.phar \
    && chmod +x ./n98-magerun-1.97.15.phar \
    && mv ./n98-magerun-1.97.15.phar /usr/local/bin/magerun

# Configuring system

ADD /.docker/config/php.ini /usr/local/etc/php/php.ini
ADD /.docker/config/magento.conf /etc/apache2/sites-available/magento.conf
ADD /.docker/config/custom-xdebug.ini /usr/local/etc/php/conf.d/custom-xdebug.ini
COPY /.docker/bin/* /usr/local/bin/
COPY /.docker/users/* /var/www/
RUN chmod +x /usr/local/bin/*
RUN ln -s /etc/apache2/sites-available/magento.conf /etc/apache2/sites-enabled/magento.conf

RUN curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
RUN echo "source /etc/bash_completion" >> /root/.bashrc
RUN echo "source /etc/bash_completion" >> /var/www/.bashrc

RUN chmod 777 -Rf /var/www /var/www/.* \
    && chown -Rf www-data:www-data /var/www /var/www/.* \
    && usermod -u 1000 www-data \
    && chsh -s /bin/bash www-data\
    && a2enmod rewrite \
    && a2enmod headers

VOLUME /var/www/html
WORKDIR /var/www/html

我试过像这样在 Dckerfile 的顶部设置平台:

FROM --platform=linux/amd64 php:5.6-apache
和许多其他变体,例如
FROM --platform=linux/x86_64 php:5.6-apache
。我查看了选项https://hub.docker.com/_/php/tags?page=1&name=5.6-apache,但无法正常工作。无论出于何种原因,apt-get 都不会运行。

docker magento-1.9 apple-m1 apt-get
© www.soinside.com 2019 - 2024. All rights reserved.