Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to create new OS thread (have 2 already; errno=22)

I have mac with M1 and if i try to run docker container with nginx-proxy by jwilder, I got this error:

api_clever4sms_nginx-proxy | runtime: failed to create new OS thread (have 2 already; errno=22)
api_clever4sms_nginx-proxy | fatal error: newosproc
api_clever4sms_nginx-proxy | 
api_clever4sms_nginx-proxy | runtime stack:
api_clever4sms_nginx-proxy | runtime.throw(0x884500, 0x9)
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/panic.go:530 +0x90
api_clever4sms_nginx-proxy | runtime.newosproc(0xc820026000, 0xc820035fc0)
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/os1_linux.go:149 +0x18c
api_clever4sms_nginx-proxy | runtime.newm(0x932358, 0x0)
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/proc.go:1513 +0x135
api_clever4sms_nginx-proxy | runtime.main.func1()
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/proc.go:125 +0x2c
api_clever4sms_nginx-proxy | runtime.systemstack(0xa8e800)
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/asm_amd64.s:291 +0x79
api_clever4sms_nginx-proxy | runtime.mstart()
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/proc.go:1048
api_clever4sms_nginx-proxy | 
api_clever4sms_nginx-proxy | goroutine 1 [running]:
api_clever4sms_nginx-proxy | runtime.systemstack_switch()
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/asm_amd64.s:245 fp=0xc820020770 sp=0xc820020768
api_clever4sms_nginx-proxy | runtime.main()
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/proc.go:126 +0x62 fp=0xc8200207c0 sp=0xc820020770
api_clever4sms_nginx-proxy | runtime.goexit()
api_clever4sms_nginx-proxy |    /usr/local/go1.6/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200207c8 sp=0xc8200207c0
api_clever4sms_nginx-proxy exited with code 2

Please do you know how to solve this?

like image 488
Petr Kvasnička Avatar asked Feb 24 '21 10:02

Petr Kvasnička


2 Answers

I run mysql docker in my M1 (arm64) and I got the same error when I try to build a container. I change mysql docker image to be image: mysql:8.0.26, platform: linux/x86_64 and add default_authentication_plugin=mysql_native_password to my.cnf Then I rebuild a docker container through those settings and it works.

like image 132
htlbydgod Avatar answered Sep 19 '22 02:09

htlbydgod


Docker has the ability to emulate amd64 on arm64 through qemu which is built into Docker Desktop for Mac.

Programs compiled for amd64/x86_64 should still work through this emulation if the Dockerfile is built for amd64

Dockerfile:

FROM --platform=linux/amd64 your_amd64_image
...

or env variable DOCKER_DEFAULT_PLATFORM=linux/amd64

The problem is that there seems to be a bug in qemu.

Here is a similar problem: https://gitlab.com/qemu-project/qemu/-/issues/340

like image 27
Timo Huovinen Avatar answered Sep 21 '22 02:09

Timo Huovinen