Skip to content
Start » Tools » LaraDock error with Mac Silicon computer (MacBook Pro M1) – Docker Desktop Apache2_1 exits with code 2

LaraDock error with Mac Silicon computer (MacBook Pro M1) – Docker Desktop Apache2_1 exits with code 2

In an installation of Laradock, to run the environment in Docker on a Mac Silicon computer (MacBook Pro or M1) following the steps below, Apache2 does not go up, showing error exited code 2:

steps

  1. git clone [email protected]:laradock/laradock.git
  2. laradock cd
  3. cp .env.example .env
  4. docker-compose build workspace
  5. docker-compose build apache2
  6. docker-compose up apache2 workspace ——> Apache2_1 exited with code 2

Resolving Apache2 exited code 2 error

To solve this problem it is necessary to edit the file /apache2/Dockerfile, found from the Laradock directory.

  1. Edit the first line by adding the platform in the statement FROM
FROM --platform=linux/x86_64 webdevops/apache:ubuntu-18.04

2. At the end of the file, add the following lines to replace the go:

RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux" \ && chmod +x "/ usr/local/bin/go-replace" \ && "/usr/local/bin/go-replace" --version

3. The final version of the file should look like this:

#FROM webdevops/apache:ubuntu-18.04 FROM --platform=linux/x86_64 webdevops/apache:ubuntu-18.04 LABEL maintainer="Eric Pfeiffer "ARG DOCUMENT_ROOT = / var / www / ARG PHP_UPSTREAM_CONTAINER = php-fpm ARG PHP_UPSTREAM_PORT = 9000 ARG PHP_UPSTREAM_TIMEOUT = 60 ARG APACHE_INSTALL_HTTP2 = false ENV WEB_PHP_SOCKET = $ {PHP_UPSTREAM_CONTAINER}: $ {PHP_UPSTREAM_PORT} ENV WEB_DOCUMENT_ROOT = $ {DOCUMENT_ROOT} ENV APACHE_HTTP2 = $ {APACHE_INSTALL_HTTP2} ENV WEB_PHP_TIMEOUT=${PHP_UPSTREAM_TIMEOUT} ENV LOG_STDOUT=/var/log/apache2/access.log ENV LOG_STDERR=/var/log/apache2/error.log EXPOSE 80 443 WORKDIR /var/www/ COPY vhost.conf / etc/apache2/sites-enabled/vhost.conf ADD ./startup.sh /opt/startup.sh ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"] CMD ["/bin/bash", "/opt /startup.sh"] EXPOSE 80 443 RUN wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64- linux" \ && chmod +x "/usr/local/bin/go-replace" \ && "/usr/local/bin/go-replace" --version

4. Finally, do the build from the container and go up again:

docker-compose build apache2 docker-compose up -d apache2

1 thought on “Erro no LaraDock com Mac Silicon computer (MacBook Pro M1) – Docker Desktop Apache2_1 sai com código 2”

  1. Pingback: Connecting Laravel Databases to Laradock - MAZER.DEV

Leave a Reply

Your email address will not be published.

en_USEnglish
%d bloggers like this: