karalabe / xgo

Go CGO cross compiler
MIT License
2.14k stars 280 forks source link

Docker in docker problem #170

Open iris-garcia opened 5 years ago

iris-garcia commented 5 years ago

Hi,

I am facing an issue when I try to cross compile using this package in a docker in docker setup. Basically there is a jenkins container (which has access to the docker.sock) and can spawn new containers, but when I try to cross compile it fails:

Checking docker installation...
Client:
 Version:      17.05.0-ce
 API version:  1.29
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:09:06 2017
 OS/Arch:      linux/amd64

Server:
 Version:      19.03.2
 API version:  1.40 (minimum version 1.12)
 Go version:   go1.12.8
 Git commit:   6a30dfc
 Built:        Thu Aug 29 05:27:45 2019
 OS/Arch:      linux/amd64
 Experimental: false

Checking for required docker image karalabe/xgo-latest... found.
Cross compiling github.com/ethereum/go-ethereum/cmd/geth...
Building locally github.com/ethereum/go-ethereum/cmd/geth...
Compiling for linux/amd64...
can't load package: package .: no Go files in /root
2019/09/07 14:03:39 Failed to cross compile package: exit status 1.

Is there a way to run xgo from a docker container?

Thanks.

shiqinfeng1 commented 4 years ago

Hi,@iris-garcia,could this problem be resolved? I encountered the same problem.

iris-garcia commented 4 years ago

Hi @shiqinfeng1, yes the way I solved it was using the following docker image in the jenkins agent:

docker {
            image 'techknowlogick/xgo:latest'
            args '-u root:root --entrypoint=\'\''
        }

Then inside this container xgo runs fine (without the need of spawning another container).

huapox commented 3 years ago

+1