couchbase / docker

Dockerfiles and configuration scripts for the Docker Hub Official Couchbase images
143 stars 154 forks source link

couchbase docker images will not run on M1 Mac architecture #167

Closed BadgerOps closed 2 years ago

BadgerOps commented 2 years ago

Hello,

As you all are probably already aware, the couchbase images will not run on an M1 Mac. It appears that at least 1 service internally is built on golang 1.8.3 which fails hard on non X86 architecture. Running using the official "try couchbase" example:

docker run --name db -p 8091-8094:8091-8094 -p 11210:11210 --platform linux/amd64 couchbase
Starting Couchbase Server -- Web UI available at http://<ip>:8091
and logs available in /opt/couchbase/var/lib/couchbase/logs
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc

runtime stack:
runtime.throw(0x4d8d66, 0x9)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/panic.go:596 +0x95
runtime.newosproc(0xc420028000, 0xc420038000)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/os_linux.go:163 +0x18c
runtime.newm(0x4df870, 0x0)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:1628 +0x137
runtime.main.func1()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:126 +0x36
runtime.systemstack(0x552700)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:1132

goroutine 1 [running]:
runtime.systemstack_switch()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:281 fp=0xc420024788 sp=0xc420024780
runtime.main()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:127 +0x6c fp=0xc4200247e0 sp=0xc420024788
runtime.goexit()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200247e8 sp=0xc4200247e0
{"init terminating in do_boot",{{badmatch,{error,{{shutdown,{failed_to_start_child,encryption_service,{port_terminated,normal}}},{ns_babysitter,start,[normal,[]]}}}},[{ns_babysitter_bootstrap,start,0,[{file,"src/ns_babysitter_bootstrap.erl"},{line,23}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({{badmatch,{error,{{_},{_}}}},[{ns_babysitter_bootstrap,start,0,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump.1637215179.95.babysitter...done
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc

runtime stack:
runtime.throw(0x4d8d66, 0x9)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/panic.go:596 +0x95
runtime.newosproc(0xc420028000, 0xc420038000)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/os_linux.go:163 +0x18c
runtime.newm(0x4df870, 0x0)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:1628 +0x137
runtime.main.func1()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:126 +0x36
runtime.systemstack(0x552700)
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:1132

goroutine 1 [running]:
runtime.systemstack_switch()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:281 fp=0xc420024788 sp=0xc420024780
runtime.main()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/proc.go:127 +0x6c fp=0xc4200247e0 sp=0xc420024788
runtime.goexit()
    /home/couchbase/.cbdepscache/exploded/x86_64/go-1.8.5/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200247e8 sp=0xc4200247e0
{"init terminating in do_boot",{{badmatch,{error,{{shutdown,{failed_to_start_child,encryption_service,{port_terminated,normal}}},{ns_babysitter,start,[normal,[]]}}}},[{ns_babysitter_bootstrap,start,0,[{file,"src/ns_babysitter_bootstrap.erl"},{line,23}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({{badmatch,{error,{{_},{_}}}},[{ns_babysitter_bootstrap,start,0,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})

Crash dump is being written to: erl_crash.dump.1637215185.262.babysitter...%                                                                                                                                    

I was able to confirm a similar failure building an image in golang 1.8.3:

docker run -it --platform linux/amd64 golang:1.8.3 /bin/bash
Unable to find image 'golang:1.8.3' locally
1.8.3: Pulling from library/golang
aa18ad1a0d33: Pull complete
15a33158a136: Pull complete
f67323742a64: Pull complete
1b4531640cb0: Pull complete
3e7f1f935f2c: Pull complete
a4db2a724d81: Pull complete
9a798ef77d30: Pull complete
Digest: sha256:32c769bf92205580d6579d5b93c3c705f787f6c648105f00bb88a35024c7f8e4
Status: Downloaded newer image for golang:1.8.3
root@cbebcf633d0f:/go# cat >> main.go << EOF
> package main
>
>
> import (
> "fmt"
> "os"
> )
>
>
> func main() {
> fmt.Printf("Hello World\n")
> os.Exit(0)
> }
> EOF
root@cbebcf633d0f:/go# go build main.go
# command-line-arguments
runtime: failed to create new OS thread (have 2 already; errno=22)
fatal error: newosproc

runtime stack:
runtime.throw(0xabc092, 0x9)
    /usr/local/go/src/runtime/panic.go:596 +0x95
runtime.newosproc(0xc420028000, 0xc420038000)
    /usr/local/go/src/runtime/os_linux.go:163 +0x18c
runtime.newm(0xad6ea0, 0x0)
    /usr/local/go/src/runtime/proc.go:1628 +0x137
runtime.main.func1()
    /usr/local/go/src/runtime/proc.go:126 +0x36
runtime.systemstack(0xda9800)
    /usr/local/go/src/runtime/asm_amd64.s:327 +0x79
runtime.mstart()
    /usr/local/go/src/runtime/proc.go:1132

goroutine 1 [running]:
runtime.systemstack_switch()
    /usr/local/go/src/runtime/asm_amd64.s:281 fp=0xc420024788 sp=0xc420024780
runtime.main()
    /usr/local/go/src/runtime/proc.go:127 +0x6c fp=0xc4200247e0 sp=0xc420024788
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc4200247e8 sp=0xc4200247e0
root@cbebcf633d0f:/go# go version
go version go1.8.3 linux/amd64
root@cbebcf633d0f:/go# exit

Then, I noticed many of your services are now building on golang 1.13.x - so I tested again:

docker run -it --platform linux/amd64 golang:1.13 /bin/bash
root@09bfc332181f:/go# cat >> main.go << EOF
> package main
> import "fmt"
> func main() {
>     fmt.Println("hello world")
> }
> EOF
root@09bfc332181f:/go# go build main.go
root@09bfc332181f:/go# ./main
hello world
root@09bfc332181f:/go# go version
go version go1.13.15 linux/amd64

This one succeeds. I'm curious if there is a public roadmap that we can follow along progress towards enabling running couchbase on M1 architecture?

Thanks!

b33f commented 2 years ago

Hello BadgerOps ,

Thank you for using Couchbase. We have a forum topic that covers running Couchbase Server on Apple Silicon here: https://forums.couchbase.com/t/apple-silicon-darwin-arm64-apple-m1-computer-hardware-w-mac-os-11

Please use that thread for any other questions. Thanks

ceejatec commented 2 years ago

This is a duplicate of #165, which was closed because I opened a product bug for it: https://issues.couchbase.com/browse/MB-48865

The user who reported #165 also published their own Docker image with a correction, which might be interesting. The product bug is still being prioritized and scheduled.

BadgerOps commented 2 years ago

Thanks @ceejatec ! My search-fu failed me, apologies for the dupe.