Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

laradock_apache2_1 exited with code 2 on Mac M1 #3086

Closed
tanveemoghe opened this issue Nov 1, 2021 · 10 comments
Closed

laradock_apache2_1 exited with code 2 on Mac M1 #3086

tanveemoghe opened this issue Nov 1, 2021 · 10 comments

Comments

@tanveemoghe
Copy link

Description:

For the first time when I install laradock on Mac M1 (OS mac Big Sur); rest all container are running well. and status is Up.
Only "Apache2" is not getting started with this error:
"laradock_apache2_1 exited with code 2"

Expected Behavior:

No local apache is running. So docker apache should be in working state.

Context information:

Output of git rev-parse HEAD
c7cb79e

{paste here}

Output of docker version

Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:23 2021
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:55:36 2021
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker-compose version

docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.9.0
OpenSSL version: OpenSSL 1.1.1h  22 Sep 2020

System info: Mac, Windows or Linux. Include which disto/version

Mac M1 chip (OS : Big Sur)

Steps to reproduce the issue:

Stacktrace & Additional info:

laradock % docker-compose ps
           Name                          Command               State                          Ports                       
--------------------------------------------------------------------------------------------------------------------------
laradock_apache2_1            /opt/docker/bin/entrypoint ...   Exit 2                                                     
laradock_docker-in-docker_1   dockerd-entrypoint.sh            Up       2375/tcp, 2376/tcp                                
laradock_mysql_1              docker-entrypoint.sh mysqld      Exit 0                                                     
laradock_php-fpm_1            docker-php-entrypoint php-fpm    Up       9000/tcp, 0.0.0.0:9003->9003/tcp,:::9003->9003/tcp
laradock_phpmyadmin_1         /docker-entrypoint.sh apac ...   Exit 0                                                     
laradock_redis_1              docker-entrypoint.sh redis ...   Exit 0                                                     
laradock_workspace_1          /sbin/my_init                    Exit 2                                                     
tanveemoghe@Tanvees-MacBook-Pro laradock % sudo docker-compose up apache2 mysql phpmyadmin redis workspace
laradock_docker-in-docker_1 is up-to-date
Starting laradock_redis_1       ... done
Recreating laradock_mysql_1     ... done
Recreating laradock_workspace_1  ... done
Recreating laradock_phpmyadmin_1 ... done
Recreating laradock_php-fpm_1    ... done
Recreating laradock_apache2_1    ... done
Attaching to laradock_redis_1, laradock_mysql_1, laradock_phpmyadmin_1, laradock_workspace_1, laradock_apache2_1
mysql_1                | 2021-11-01 13:12:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
mysql_1                | 2021-11-01 13:12:42+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
phpmyadmin_1           | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.4. Set the 'ServerName' directive globally to suppress this message
mysql_1                | 2021-11-01 13:12:43+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
workspace_1            | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
workspace_1            | *** Running /etc/my_init.d/10_syslog-ng.init...
workspace_1            | [2021-11-01T13:12:45.231751] WARNING: Configuration file format is too old, syslog-ng is running in compatibility mode. Please update it to use the syslog-ng 3.25 format at your time of convenience. To upgrade the configuration, please review the warnings about incompatible changes printed by syslog-ng, and once completed change the @version header at the top of the configuration file; config-version='3.13'
workspace_1            | [2021-11-01T13:12:45.437121] WARNING: With use-dns(no), dns-cache() will be forced to 'no' too!;
workspace_1            | Nov  1 13:12:45 0795290de36f syslog-ng[15]: syslog-ng starting up; version='3.25.1'
workspace_1            | Nov  1 13:12:45 0795290de36f syslog-ng[15]: WARNING: log-fifo-size() works differently starting with syslog-ng 3.22 to avoid dropping flow-controlled messages when log-fifo-size() is misconfigured. From now on, log-fifo-size() only affects messages that are not flow-controlled. (Flow-controlled log paths have the flags(flow-control) option set.) To enable the new behaviour, update the @version string in your configuration and consider lowering the value of log-fifo-size().;
workspace_1            | *** Booting runit daemon...
workspace_1            | *** Runit started as PID 23
workspace_1            | Nov  1 13:12:46 0795290de36f cron[26]: (CRON) INFO (pidfile fd = 3)
workspace_1            | Nov  1 13:12:46 0795290de36f cron[26]: (CRON) INFO (Running @reboot jobs)
redis_1                | 1:C 01 Nov 2021 13:12:40.001 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1                | 1:C 01 Nov 2021 13:12:40.001 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1                | 1:C 01 Nov 2021 13:12:40.001 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1                | 1:M 01 Nov 2021 13:12:40.002 * monotonic clock: POSIX clock_gettime
redis_1                | 1:M 01 Nov 2021 13:12:40.008 * Running mode=standalone, port=6379.
redis_1                | 1:M 01 Nov 2021 13:12:40.008 # Server initialized
phpmyadmin_1           | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.25.0.4. Set the 'ServerName' directive globally to suppress this message
mysql_1                | 2021-11-01T13:12:44.697041Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
mysql_1                | 2021-11-01T13:12:44.699046Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
mysql_1                | 2021-11-01T13:12:44.699262Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 1
mysql_1                | 2021-11-01T13:12:44.718292Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
mysql_1                | 2021-11-01T13:12:44.747468Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
phpmyadmin_1           | [Mon Nov 01 13:12:43.522198 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.4.20 configured -- resuming normal operations
phpmyadmin_1           | [Mon Nov 01 13:12:43.529873 2021] [core:notice] [pid 1] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
mysql_1                | 2021-11-01T13:12:44.984180Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
redis_1                | 1:M 01 Nov 2021 13:12:40.016 * Loading RDB produced by version 6.2.6
redis_1                | 1:M 01 Nov 2021 13:12:40.016 * RDB age 356 seconds
redis_1                | 1:M 01 Nov 2021 13:12:40.016 * RDB memory usage when created 0.80 Mb
redis_1                | 1:M 01 Nov 2021 13:12:40.016 # Done loading RDB, keys loaded: 0, keys expired: 0.
mysql_1                | 2021-11-01T13:12:45.660533Z 1 [ERROR] [MY-012585] [InnoDB] Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.
mysql_1                | 2021-11-01T13:12:45.661033Z 1 [Warning] [MY-012654] [InnoDB] Linux Native AIO disabled.
redis_1                | 1:M 01 Nov 2021 13:12:40.016 * DB loaded from disk: 0.004 seconds
redis_1                | 1:M 01 Nov 2021 13:12:40.016 * Ready to accept connections
mysql_1                | 2021-11-01T13:12:49.972786Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
apache2_1              | Log stdout redirected to /var/log/apache2/access.log
apache2_1              | Log stderr redirected to /var/log/apache2/error.log
apache2_1              | runtime: failed to create new OS thread (have 2 already; errno=22)
apache2_1              | fatal error: newosproc
apache2_1              | 
apache2_1              | runtime stack:
apache2_1              | runtime.throw(0x6430dc, 0x9)
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/panic.go:596 +0x95
apache2_1              | runtime.newosproc(0xc420026000, 0xc420036000)
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/os_linux.go:163 +0x18c
apache2_1              | runtime.newm(0x650dd0, 0x0)
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1628 +0x137
apache2_1              | runtime.main.func1()
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:126 +0x36
apache2_1              | runtime.systemstack(0x75bb00)
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:327 +0x79
apache2_1              | runtime.mstart()
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:1132
apache2_1              | 
apache2_1              | goroutine 1 [running]:
apache2_1              | runtime.systemstack_switch()
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:281 fp=0xc420022788 sp=0xc420022780
apache2_1              | runtime.main()
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/proc.go:127 +0x6c fp=0xc4200227e0 sp=0xc420022788
apache2_1              | runtime.goexit()
apache2_1              | 	/usr/local/Cellar/go/1.8.1/libexec/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200227e8 sp=0xc4200227e0
mysql_1                | 2021-11-01T13:12:52.340609Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
mysql_1                | 2021-11-01T13:12:52.340906Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
mysql_1                | 2021-11-01T13:12:52.428384Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
mysql_1                | 2021-11-01T13:12:52.430378Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
laradock_apache2_1 exited with code 2
mysql_1                | 2021-11-01T13:12:52.478475Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql_1                | 2021-11-01T13:12:52.928415Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
mysql_1                | 2021-11-01T13:12:52.931588Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.27'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
workspace_1            | Nov  1 13:13:01 0795290de36f CRON[32]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:14:01 0795290de36f CRON[36]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:15:01 0795290de36f CRON[41]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:16:01 0795290de36f CRON[46]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:17:01 0795290de36f CRON[51]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:17:01 0795290de36f CRON[50]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
workspace_1            | Nov  1 13:18:01 0795290de36f CRON[57]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:19:01 0795290de36f CRON[61]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:20:01 0795290de36f CRON[65]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:21:01 0795290de36f CRON[69]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
workspace_1            | Nov  1 13:22:01 0795290de36f CRON[75]: (laradock) CMD (/usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1)
^CGracefully stopping... (press Ctrl+C again to force)
Stopping laradock_phpmyadmin_1   ... done
Stopping laradock_workspace_1    ... done
Stopping laradock_mysql_1        ... done
Stopping laradock_redis_1        ... done
@tanveemoghe tanveemoghe changed the title laradock_apache2_1 exited with code 2 laradock_apache2_1 exited with code 2 on Mac M1 Nov 1, 2021
@ronaldwanink
Copy link

Had this issue also, fixed it with info from webdevops/Dockerfile#395.

That said, now my docker file is not usable on non M1 architectures, so I am definitely interested in a proper Laradock solution.

@ronaldwanink
Copy link

ronaldwanink commented Nov 10, 2021

To save some debug time of others: on M1 I added the following in the apache2/Dockerfile

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

On Intel this should not run of course, so either comment it out or make it architecture dependent.

@polarikus
Copy link
Contributor

polarikus commented Nov 22, 2021

Add on .env file FOR_M1=true variable

And in your apache2/Dockerfile:

RUN if [ ${FOR_M1} = true ]; then wget -O "/usr/local/bin/go-replace" "https://github.com/webdevops/goreplace/releases/download/1.1.2/gr-arm64-linux"; fi
RUN if [ ${FOR_M1} = true ]; then chmod +x "/usr/local/bin/go-replace"; fi
RUN if [ ${FOR_M1} = true ]; then "/usr/local/bin/go-replace" --version; fi

@ToTacitus
Copy link

ToTacitus commented Dec 7, 2021

Same problem here! On a Mac Silicon computer (MacBook Pro 2021):

  1. git clone git@github.com:laradock/laradock.git
  2. cd laradock
  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

Running Docker Desktop for Apple M1 (v.4.3.0) on MacOS Monterey 12.01

2021-12-07_18-51-15

@ToTacitus
Copy link

The solution, after much investigation:

  1. Open /apache2/Dockerfile

  2. Edit the first line in the file to look like this:
    FROM --platform=linux/x86_64 webdevops/apache:ubuntu-18.04

  3. At the end of the file, add this:
    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. Do this:
    docker-compose build apache2
    docker-compose up apache2

Should work fine now!

@supasheva
Copy link

The solution, after much investigation:

  1. Open /apache2/Dockerfile
  2. Edit the first line in the file to look like this:
    FROM --platform=linux/x86_64 webdevops/apache:ubuntu-18.04
  3. At the end of the file, add this:
    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. Do this:
    docker-compose build apache2
    docker-compose up apache2

Should work fine now!

Thank you!

@stale
Copy link

stale bot commented Jun 11, 2022

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Jun 11, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Jul 10, 2022
@polarikus
Copy link
Contributor

#3279

I sent a PR to solve this topic

@miraclebg
Copy link

I still wasn't able to run it today on my M2. Had to manually add:

services:
apache2:
platform: linux/amd64

Only then it started properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants