brocaar/chirpstack-packet-multiplexer

Docker-build / make fails

wsdt opened this issue · 2 comments

wsdt commented

Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"./lora-packet-multiplexer\": stat ./lora-packet-multiplexer: no such file or directory": unknown

Steps for reproduction:

  1. Clone project
  2. docker-compose run --rm packetmultiplexer bash

I'm able to start the container if I copy the root folder into cmd. Unfortunately, there are similar reference errors within the container (related to make). The same error occurs if simply building the Dockerfile:

go: finding github.com/brocaar/lora-packet-multiplexer/cmd latest build command-line-arguments: cannot load github.com/brocaar/lora-packet-multiplexer/cmd/lora-packet-multiplexer/cmd: cannot find module providing package github.com/brocaar/lora-packet-multiplexer/cmd/lora-packet-multiplexer/cmd make: *** [Makefile:6: build] Error 1

This might be related to your Docker setup?

~/W/P/L/R/lora-packet-multiplexer (master|✔) $ cat docker-compose.yml 
version: "3"
services:
  packetmultiplexer:
    build:
      context: .
      dockerfile: Dockerfile-devel
    volumes:
      - ./:/lora-packet-multiplexer
~/W/P/L/R/lora-packet-multiplexer (master|✔) $ docker-compose build packetmultiplexer
Building packetmultiplexer
Step 1/10 : FROM golang:1.12-alpine
 ---> c7330979841b
Step 2/10 : ENV PROJECT_PATH=/lora-packet-multiplexer
 ---> Running in aa529ee90c5d
Removing intermediate container aa529ee90c5d
 ---> 3f94a4693ef9
Step 3/10 : ENV PATH=$PATH:$PROJECT_PATH/build
 ---> Running in 2f316084de9e
Removing intermediate container 2f316084de9e
 ---> 6ee133e2307e
Step 4/10 : ENV CGO_ENABLED=0
 ---> Running in 643a762d9326
Removing intermediate container 643a762d9326
 ---> 830b11e12258
Step 5/10 : ENV GO_EXTRA_BUILD_ARGS="-a -installsuffix cgo"
 ---> Running in e60fc2d7c75b
Removing intermediate container e60fc2d7c75b
 ---> 46761dd2b4e4
Step 6/10 : RUN apk add --no-cache ca-certificates tzdata make git bash
 ---> Running in bc222356c17b
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/13) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(2/13) Installing ncurses-terminfo (6.1_p20190105-r0)
(3/13) Installing ncurses-libs (6.1_p20190105-r0)
(4/13) Installing readline (7.0.003-r1)
(5/13) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(6/13) Installing nghttp2-libs (1.35.1-r0)
(7/13) Installing libssh2 (1.8.2-r0)
(8/13) Installing libcurl (7.64.0-r2)
(9/13) Installing expat (2.2.7-r0)
(10/13) Installing pcre2 (10.32-r1)
(11/13) Installing git (2.20.1-r0)
(12/13) Installing make (4.2.1-r2)
(13/13) Installing tzdata (2019a-r0)
Executing busybox-1.29.3-r10.trigger
OK: 33 MiB in 28 packages
Removing intermediate container bc222356c17b
 ---> f478552fdde7
Step 7/10 : RUN mkdir -p $PROJECT_PATH
 ---> Running in faf9c8b3e882
Removing intermediate container faf9c8b3e882
 ---> e6751d0830d8
Step 8/10 : COPY . $PROJECT_PATH
 ---> e9bb74a446d6
Step 9/10 : WORKDIR $PROJECT_PATH
 ---> Running in 2c64164ebc82
Removing intermediate container 2c64164ebc82
 ---> 4a25c88cbc0a
Step 10/10 : RUN make dev-requirements
 ---> Running in 8c95202bc94c
go install golang.org/x/tools/cmd/stringer
go: finding github.com/goreleaser/goreleaser v0.106.0
go: finding github.com/inconshreveable/mousetrap v1.0.0                                                                                                                  
go: finding github.com/spf13/cobra v0.0.3                                                                                                                                
go: finding github.com/goreleaser/nfpm v0.11.0                                                                                                                           
go: finding github.com/sirupsen/logrus v1.4.1                                                                                                                            
go: finding github.com/pkg/errors v0.8.1                                                                                                                                 
go: finding github.com/BurntSushi/toml v0.3.1                                                                                                                            
go: finding github.com/spf13/viper v1.3.2                                                                                                                                
go: finding github.com/stretchr/testify v1.3.0                                                                                                                           
go: finding golang.org/x/tools v0.0.0-20190509014725-d996b19ee77c                                                                                                        
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58                                                                                                         
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a                                                                                                          
go: finding github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8                                                                                                
go: finding github.com/coreos/go-etcd v2.0.0+incompatible                                                                                                                
go: finding github.com/konsorten/go-windows-terminal-sequences v1.0.1                                                                                                    
go: finding github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6                                                                                               
go: finding github.com/pelletier/go-toml v1.2.0                                                                                                                          
go: finding github.com/pkg/errors v0.8.0                                                                                                                                 
go: finding github.com/imdario/mergo v0.3.4                                                                                                                              
go: finding golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4                                                                                                       
go: finding gopkg.in/yaml.v2 v2.2.2                                                                                                                                      
go: finding gopkg.in/yaml.v2 v2.2.1                                                                                                                                      
go: finding github.com/apex/log v1.1.0                                                                                                                                   
go: finding github.com/aws/aws-sdk-go v1.15.64                                                                                                                           
go: finding golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9                                                                                                       
go: finding github.com/fatih/color v1.7.0                                                                                                                                
go: finding github.com/kamilsk/retry/v4 v4.0.0                                                                                                                           
go: finding github.com/mitchellh/go-homedir v1.0.0                                                                                                                       
go: finding github.com/coreos/go-semver v0.2.0                                                                                                                           
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2                                                                                                       
go: finding github.com/hashicorp/hcl v1.0.0                                                                                                                              
go: finding github.com/spf13/afero v1.1.2                                                                                                                                
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a                                                                                                          
go: finding github.com/spf13/cast v1.3.0                                                                                                                                 
go: finding github.com/davecgh/go-spew v1.1.1                                                                                                                            
go: finding github.com/stretchr/testify v1.2.2                                                                                                                           
go: finding golang.org/x/sys v0.0.0-20181030150119-7e31e0c00fa0                                                                                                          
go: finding github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53                                                                                                 
go: finding golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519                                                                                                          
go: finding github.com/mattn/go-zglob v0.0.0-20171230104132-4959821b4817                                                                                                 
go: finding github.com/magiconair/properties v1.8.0                                                                                                                      
go: finding gopkg.in/alecthomas/kingpin.v2 v2.2.6                                                                                                                        
go: finding github.com/mattn/go-isatty v0.0.4                                                                                                                            
go: finding github.com/alecthomas/kingpin v2.2.6+incompatible                                                                                                            
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405                                                                                                         
go: finding github.com/spf13/jwalterweatherman v1.0.0                                                                                                                    
go: finding github.com/stretchr/objx v0.1.0                                                                                                                              
go: finding github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2                                                                                                  
go: finding github.com/coreos/etcd v3.3.10+incompatible                                                                                                                  
go: finding github.com/google/go-querystring v1.0.0                                                                                                                      
go: finding github.com/fsnotify/fsnotify v1.4.7                                                                                                                          
go: finding github.com/stretchr/testify v1.2.1                                                                                                                           
go: finding github.com/pmezard/go-difflib v1.0.0                                                                                                                         
go: finding github.com/mitchellh/mapstructure v1.1.2                                                                                                                     
go: finding github.com/google/go-github v17.0.0+incompatible                                                                                                             
go: finding google.golang.org/appengine v1.2.0                                                                                                                           
go: finding github.com/Masterminds/semver v1.4.2                                                                                                                         
go: finding github.com/spf13/pflag v1.0.3                                                                                                                                
go: finding github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e                                                                                                  
go: finding github.com/mattn/go-colorable v0.0.9                                                                                                                         
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f                                                                                                         
go: finding github.com/caarlos0/ctrlc v1.0.0                                                                                                                             
go: finding golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33                                                                                                          
go: finding github.com/imdario/mergo v0.3.6                                                                                                                              
go: finding github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77                                                                                        
go: finding github.com/stretchr/objx v0.1.1                                                                                                                              
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225                                                                                                          
go: finding golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a                                                                                                          
go: finding github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf                                                                                               
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc                                                                                            
go: finding github.com/davecgh/go-spew v1.1.0                                                                                                                            
go: finding github.com/golang/protobuf v1.2.0                                                                                                                            
go: finding golang.org/x/text v0.3.0                                                                                                                                     
go: finding github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8                                                                                           
go: downloading golang.org/x/tools v0.0.0-20190509014725-d996b19ee77c                                                                                                    
go: extracting golang.org/x/tools v0.0.0-20190509014725-d996b19ee77c                                                                                                     
go install github.com/goreleaser/goreleaser
go: downloading github.com/goreleaser/goreleaser v0.106.0
go: extracting github.com/goreleaser/goreleaser v0.106.0                                                                                                                 
go: downloading github.com/fatih/color v1.7.0                                                                                                                            
go: downloading github.com/caarlos0/ctrlc v1.0.0                                                                                                                         
go: downloading github.com/apex/log v1.1.0                                                                                                                               
go: downloading gopkg.in/alecthomas/kingpin.v2 v2.2.6                                                                                                                    
go: downloading gopkg.in/yaml.v2 v2.2.2                                                                                                                                  
go: downloading github.com/pkg/errors v0.8.1                                                                                                                             
go: downloading github.com/mitchellh/go-homedir v1.0.0                                                                                                                   
go: downloading github.com/Masterminds/semver v1.4.2
go: downloading github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e
go: extracting github.com/caarlos0/ctrlc v1.0.0
go: downloading github.com/goreleaser/nfpm v0.11.0
go: extracting github.com/mitchellh/go-homedir v1.0.0
go: downloading github.com/imdario/mergo v0.3.6
go: extracting github.com/pkg/errors v0.8.1
go: extracting github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e
go: downloading golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: downloading github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53
go: extracting github.com/apex/log v1.1.0
go: extracting github.com/Masterminds/semver v1.4.2
go: downloading github.com/kamilsk/retry/v4 v4.0.0
go: downloading github.com/aws/aws-sdk-go v1.15.64
go: extracting github.com/imdario/mergo v0.3.6
go: extracting github.com/mattn/go-zglob v0.0.0-20180803001819-2ea3427bfa53
go: downloading github.com/mattn/go-colorable v0.0.9
go: extracting github.com/kamilsk/retry/v4 v4.0.0
go: extracting github.com/mattn/go-colorable v0.0.9
go: extracting github.com/fatih/color v1.7.0
go: extracting github.com/goreleaser/nfpm v0.11.0
go: downloading github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
go: downloading github.com/mattn/go-isatty v0.0.4
go: downloading github.com/google/go-github v17.0.0+incompatible
go: extracting github.com/blakesmith/ar v0.0.0-20150311145944-8bd4349a67f2
go: extracting github.com/mattn/go-isatty v0.0.4
go: extracting golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: downloading golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4
go: extracting github.com/google/go-github v17.0.0+incompatible
go: downloading github.com/google/go-querystring v1.0.0
go: extracting github.com/google/go-querystring v1.0.0
go: extracting golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4
go: downloading golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: extracting gopkg.in/yaml.v2 v2.2.2
go: extracting gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: downloading github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: downloading github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: extracting github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: extracting github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: extracting golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: extracting github.com/aws/aws-sdk-go v1.15.64
go: downloading github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go: extracting github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8
go install github.com/goreleaser/nfpm
Removing intermediate container 8c95202bc94c
 ---> f5f2aa49ef5c
Successfully built f5f2aa49ef5c
Successfully tagged lora-packet-multiplexer_packetmultiplexer:latest
~/W/P/L/R/lora-packet-multiplexer (master|✔) $ docker-compose run --rm packetmultiplexer bash
bash-4.4# 

In my case the copy didn't seem to put the binary in /root/ somehow.
I just changed the entrypoint: docker-compose run --rm --entrypoint=/root/build/chirpstack-packet-multiplexer chirpstack-packet-multiplexer