Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: Apache in Apple Silicon M1

I have a docker-compose.yml file:

version: '1'
services:
  mariadb:
    image: 'docker.io/bitnami/mariadb:10.3-debian-10'
    ports:
      - '3307:3306'
    volumes:
      - ./db:/bitnami/mariadb
    environment:
      - MARIADB_USER=bn_wordpress
      - MARIADB_DATABASE=bitnami_wordpress
      - ALLOW_EMPTY_PASSWORD=yes
  wordpress:
    image: 'docker.io/bitnami/wordpress:5-debian-10'
    ports:
      - '8081:8080'
      - '8444:8443'
    volumes:
      - ./wp:/bitnami/wordpress
    depends_on:
      - mariadb
    environment:
      - MARIADB_HOST=mariadb
      - MARIADB_PORT_NUMBER=3306
      - WORDPRESS_DATABASE_USER=bn_wordpress
      - WORDPRESS_DATABASE_NAME=bitnami_wordpress
      - ALLOW_EMPTY_PASSWORD=yes

In Mac (Intel) and Linux, I run docker-compose up and it works perfectly.
But in Macbook M1, I installed Docker for Apple Silicon chip and updated rosetta, it prompts this at the end:

wordpress_1  | wordpress 15:48:36.49 INFO  ==> ** Starting Apache **
wordpress_1  | [Tue Jul 13 15:48:36.652803 2021] [core:emerg] [pid 1] (95)Operation not supported: AH00023: Couldn't create the mpm-accept mutex 
wordpress_1  | (95)Operation not supported: could not create accept mutex
wordpress_1  | AH00015: Unable to open logs

How can I overcome the issue? Appreciate your help!

like image 269
Danny Avatar asked Jul 13 '21 16:07

Danny


People also ask

Is docker compatible with Mac M1?

Docker image was built in only seven minutes on MacBook M1 Pro, which was even better than the build time on my new VPS. This is not surprising, I gave Docker quite a lot of resources. But it also shows that if there are not too many I/O disk operations, performance is quite good.

Can you run docker on Apple silicon?

Docker Desktop for Mac on Apple silicon is now available as a GA release. This enables you to develop applications with your choice of local development environments, and extends development pipelines for ARM-based applications.

Can I run x86 docker image on M1?

Although the M1 version docker desktop allows users to run x86 docker images under emulation, it will be a more efficient solution to offer your software as a “universal” Multi-Arch docker image that can serve both your ARM (M1) and x86 users.

How do I start docker on Mac M1?

To run the Docker Desktop, simply double-click the Docker app in the Application folder. To confirm that the Docker Desktop is running, you should be seeing the Docker icon on the Menu Bar and it says Docker Desktop is running… You will also see the below Docker Desktop app window.

Does Docker desktop run on Apple’s new M1 chips?

Although Apple has released Rosetta 2 to help move applications over to the new M1 chips, this does not get us all the way with Docker Desktop. Under the hood of Docker Desktop, we run a virtual machine, to achieve this on Apple’s new hardware we need to move onto Apple’s new hypervisor framework.

What is Docker doing for the new Macs?

We saw the first spotlight of these efforts at Apple WWDC in June, when Apple highlighted Docker Desktop on stage. Our goal at Docker is to provide the same great experience on the new Macs as we do today for our millions of users on Docker Desktop for Mac, and to make this transition as seamless as possible.

What processor do I need to run Docker desktop?

This version of Docker Desktop requires an Intel processor. To learn more about this issue see: Show activity on this post. See the download link at the top. This is a link to DMG file.

Can I run ARM64 containers on Apple Silicon machines?

We recommend running arm64 containers on Apple Silicon machines whenever possible, and encouraging container authors to produce arm64, or multi-arch, versions of their containers. We expect this issue to become less common over time, as more and more images are rebuilt supporting multiple architectures.


Video Answer


2 Answers

A bit late but have you tried adding platform: linux/amd64? Under both mariadb and wordpress

like image 92
Carlos Amorós Avatar answered Oct 19 '22 21:10

Carlos Amorós


Running docker compose with platform: linux/amd64 (i.e. running under QEMU) didn't fix this problem for me. Instead (in addition), I had to add:

Mutex posixsem

... to httpd.conf.

like image 22
PaoloC Avatar answered Oct 19 '22 21:10

PaoloC