skip to Main Content

Below is my Dockerfile. This file is successfully building on a colleague’s Windows computer, as well as another’s Mac Studio running Ventura (just like me except it has an M2 chip, and I have an M1 chip). This is to support a Magento 1.9.x install, so if anyone knows a good docker setup for that on MacOS with an M1 chip, please do tell!

The error:

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

Full log out put with errors:

 docker-compose up -d
[+] Building 4.3s (6/33)                                                                                                                                                                                                                                                                                                
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                               0.0s
 => => transferring dockerfile: 3.38kB                                                                                                                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/php:5.6-apache                                                                                                                                                                                                                                                  1.6s
 => [internal] load build context                                                                                                                                                                                                                                                                                  0.0s
 => => transferring context: 522B                                                                                                                                                                                                                                                                                  0.0s
 => CACHED [ 1/29] FROM docker.io/library/php:5.6-apache@sha256:0a40fd273961b99d8afe69a61a68c73c04bc0caa9de384d3b2dd9e7986eec86d                                                                                                                                                                                   0.0s
 => ERROR [ 2/29] RUN apt-get -y update                                                                                                                                                                                                                                                                            2.7s
------                                                                                                                                                                                                                                                                                                                  
 > [ 2/29] RUN apt-get -y update:                                                                                                                                                                                                                                                                                       
#0 0.486 Ign:1 http://deb.debian.org/debian stretch InRelease                                                                                                                                                                                                                                                           
#0 0.497 Ign:2 http://security.debian.org/debian-security stretch/updates InRelease                                                                                                                                                                                                                                     
#0 0.519 Ign:3 http://deb.debian.org/debian stretch-updates InRelease                                                                                                                                                                                                                                                   
#0 0.529 Ign:4 http://security.debian.org/debian-security stretch/updates Release                                                                                                                                                                                                                                       
#0 0.542 Ign:5 http://deb.debian.org/debian stretch Release
#0 0.543 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 0.558 Ign:7 http://deb.debian.org/debian stretch-updates Release
#0 0.704 Ign:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 0.704 Ign:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 0.721 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 0.732 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 0.751 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 0.862 Ign:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 0.874 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 0.879 Ign:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 1.031 Ign:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 1.071 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 1.093 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 1.156 Ign:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 1.176 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 1.239 Ign:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 1.317 Ign:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 1.339 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 1.371 Ign:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 1.396 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 1.414 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 1.496 Ign:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 1.511 Ign:6 http://security.debian.org/debian-security stretch/updates/main all Packages
#0 1.544 Ign:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 1.655 Err:9 http://security.debian.org/debian-security stretch/updates/main armhf Packages
#0 1.655   404  Not Found [IP: 151.101.130.132 80]
#0 1.684 Ign:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 1.701 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 1.711 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 1.852 Ign:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 1.991 Ign:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 2.023 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 2.050 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 2.185 Ign:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 2.328 Err:8 http://deb.debian.org/debian stretch/main armhf Packages
#0 2.328   404  Not Found
#0 2.349 Ign:10 http://deb.debian.org/debian stretch/main all Packages
#0 2.371 Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
#0 2.515 Err:12 http://deb.debian.org/debian stretch-updates/main armhf Packages
#0 2.515   404  Not Found
#0 2.570 Reading package lists...
#0 2.654 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
#0 2.655 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
#0 2.655 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
#0 2.655 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-armhf/Packages  404  Not Found [IP: 151.101.130.132 80]
#0 2.655 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-armhf/Packages  404  Not Found
#0 2.655 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-armhf/Packages  404  Not Found
#0 2.655 E: Some index files failed to download. They have been ignored, or old ones used instead.
------
failed to solve: process "/bin/sh -c apt-get -y update" did not complete successfully: exit code: 100

Also, it’s getting 404s, but again, this same Dockerfile builds on my colleagues computers.

The 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

I’ve tried setting the platform at the top of the Dckerfile like this:
FROM --platform=linux/amd64 php:5.6-apache and many other variations such as FROM --platform=linux/x86_64 php:5.6-apache. I’ve looked at options https://hub.docker.com/_/php/tags?page=1&name=5.6-apache, but can’t get anything to work. For whatever reason, apt-get just won’t go.

2

Answers


  1. Chosen as BEST ANSWER

    Adding the below commands to my Dockerfile, before the apt-get commands, did the trick. Was slow to download, but the Docker containers came up and it works as expected.

    RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
    RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
    RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
    

  2. You need to use docker buildx build --platform linux/amd64,linux/arm64 . to build an image that can run on both AMD64 (x86) and ARM64 (the M1)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search