Home > OS >  Docker M1 - Using Ubuntu MySQL: /bin/sh errors on latest update Docker Desktop 4.2.0
Docker M1 - Using Ubuntu MySQL: /bin/sh errors on latest update Docker Desktop 4.2.0

Time:11-23

I'm struggling to get build my project after updating my Docker.

My previous working DockerFile:

FROM ubuntu:20.04


ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN apt-get update \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
    && mkdir -p ~/.gnupg \
    && chmod 600 ~/.gnupg \
    && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
    && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C \
    && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C \
    && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
    && apt-get update \
    && apt-get install -y php7.4-cli php7.4-dev \
       php7.4-pgsql php7.4-sqlite3 php7.4-gd \
       php7.4-curl php7.4-memcached \
       php7.4-imap php7.4-mysql php7.4-mbstring \
       php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \
       php7.4-intl php7.4-readline php7.4-pcov \
       php7.4-msgpack php7.4-igbinary php7.4-ldap \
       php7.4-redis \
    && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
    && curl -sL https://deb.nodesource.com/setup_15.x | bash - \
    && apt-get install -y nodejs \
    && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
    && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
    && apt-get update \
    && apt-get install -y yarn \
    && apt-get install -y mysql-client \
    && apt-get install -y postgresql-client \
    && apt-get -y autoremove \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

With the Platform: platform: linux/x86_64 in my Docker-Compose.

However, it now isn't working after updating Docker and I'm clueless why.

Returns the response now of:

After this operation, 116 MB of additional disk space will be used. Get:1 https://deb.nodesource.com/node_15.x focal/main arm64 nodejs arm64 15.14.0-deb-1nodesource1 [24.8 MB] debconf: delaying package configuration, since apt-utils is not installed Fetched 24.8 MB in 2s (12.5 MB/s) Selecting previously unselected package nodejs. (Reading database ... 21576 files and directories currently installed.) Preparing to unpack .../nodejs_15.14.0-deb-1nodesource1_arm64.deb ... Unpacking nodejs (15.14.0-deb-1nodesource1) ... Setting up nodejs (15.14.0-deb-1nodesource1) ... Processing triggers for man-db (2.9.1-1) ... Warning: apt-key output should not be parsed (stdout is not a terminal) gpg: no valid OpenPGP data found. Segmentation fault 1

error occurred: * Status: The command '/bin/sh -c apt-get update && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && mkdir -p ~/.gnupg && chmod 600 ~/.gnupg && echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E5267A6C && apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C300EE8C && echo "deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list && apt-get update
&& apt-get install -y php7.4-cli php7.4-dev php7.4-pgsql php7.4-sqlite3 php7.4-gd php7.4-curl php7.4-memcached
php7.4-imap php7.4-mysql php7.4-mbstring php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap php7.4-intl php7.4-readline php7.4-pcov php7.4-msgpack php7.4-igbinary php7.4-ldap
php7.4-redis && php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer && curl -sL https://deb.nodesource.com/setup_15.x | bash - && apt-get install -y nodejs && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get install -y yarn && apt-get install -y mysql-client && apt-get install -y postgresql-client && apt-get -y autoremove
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*' returned a non-zero code: 2, Code: 2

Steps tried (Specifying Ubuntu version in case there's some incompatibilities):

FROM --platform=linux/arm64/v8 ubuntu:18.04

Error 1: Unable to locate package python2

FROM --platform=linux/arm64/v8 ubuntu:21.04

Error 1: The following packages have unmet dependencies: libxml2 : Depends: libicu66 (>= 66.1-1~) but it is not installable php7.4-intl : Depends: libicu66 (>= 66.1-1~) but it is not installable

Error 2: Unable to correct problems, you have held broken packages. 1 error occurred: Status: The command '/bin/sh -c [....] returned a non-zero code: 100, Code: 100

FROM --platform=linux/arm64/v8 ubuntu:22.04

Error 1: The following packages have unmet dependencies: libxml2 : Depends: libicu66 (>= 66.1-1~) but it is not installable php7.4-intl : Depends: libicu66 (>= 66.1-1~) but it is not installable

Error 2: Unable to correct problems, you have held broken packages. 1 error occurred: Status: The command '/bin/sh -c [....] returned a non-zero code: 100, Code: 100

Docker-Compose:

I have specified my platform to now be platform: linux/amd64rather than platform: linux/x86_64 as per to the docs. Tried using linux/arm64 but that didn't work either (Same errors produced).

CodePudding user response:

Fixed it, I was being an idiot yesterday night.

Solution A: (In my case): Downgrade back to Docker Desktop version 4.0.0. I was using Intel Images so that's why I had to specify x86_64.

A more better solution would to change all my images be Arm64 and Intel based as well as it being compatible with Ubuntu Mysql (currently docker Is recommending to use MariaDB for now)

However - seeing that Docker is still relatively unstable and can stop your build process at any moment, I advise anyone to update the Docker for M1 with caution!

  • Related