kubernetes-up-and-running / kuard

Demo app for Kubernetes Up and Running book
Apache License 2.0
1.61k stars 541 forks source link

Issue with initial dockerfile in KUAR chapter 2 #7

Closed iramsey85 closed 5 years ago

iramsey85 commented 7 years ago

There are instructions in chapter 2 for create a simple dockerfile that will create an image for the user. In the file, there is a command to copy from source bin/kuard to a place on your local machine. My instance of docker is throwing an error:

"stat /var/lib/docker/tmp/docker-builder803175328/bin/kuard: no such file or directory"

Has this directory been updated in some way?

LakerBaker commented 7 years ago

I'm seeing the same issue: COPY failed: stat /var/lib/docker/tmp/docker-builder675345009/bin/kuard: no such file or directory I'm using a Mac.

rogerscuall commented 7 years ago

I'm having the same problem, you need a directory bin/kuard on the local host. Anyway if you want to keep moving with the book use docker pull gcr.io/kuar-demo/kuard-amd64:1 and you will download the image.

brendandburns commented 7 years ago

If you want bin/kuard you need to build the binary. You can do this by running:

make

zekefast commented 7 years ago

@brendandburns make does not work either.

Short version:

$ LANG=C make
building : bin/1/amd64/kuard
go install github.com/kubernetes-up-and-running/kuard/cmd/kuard: open /data/go/bin/kuard: permission denied
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

With more details:

$ LANG=C make VERBOSE=1
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.5-3-gb867e02-1 -u $(id -u):$(id -g) -v kuard-build-data:/data -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard -v $(pwd)/bin/1/amd64:/data/go/bin -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64 -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
Verbose: 1
Building with VERBOSE
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.5-3-gb867e02-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
+ cd client
+ npm install --loglevel=error
+ npm run build

> client@1.0.0 build /data/go/src/github.com/kubernetes-up-and-running/kuard/client
> NODE_ENV=production webpack

Hash: 83005bbd70ef498c3be7
Version: webpack 1.15.0
Time: 10380ms
        Asset       Size  Chunks             Chunk Names
    bundle.js     316 kB       0  [emitted]  main
bundle.js.map  164 bytes       0  [emitted]  main
    + 263 hidden modules
+ go generate -x ./cmd/... ./pkg/...
go-bindata -pkg sitedata -prefix ../../sitedata/ -o bindata.go ../../sitedata/...
+ go install -x -installsuffix static -ldflags '-X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.5-3-gb867e02-1' ./cmd/...
WORK=/tmp/go-build244358620
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/sitedata -complete -installsuffix static -buildid c295c07b6aedeef71729c3e740bc61f45c84bf9a -importmap github.com/elazarl/go-bindata-assetfs=github.com/kubernetes-up-and-running/kuard/vendor/github.com/elazarl/go-bindata-assetfs -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/pkg/errors=github.com/kubernetes-up-and-running/kuard/vendor/github.com/pkg/errors -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./bindata.go ./doc.go ./sitedata.go
mkdir -p /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -complete -installsuffix static -buildid d30682a8c304174943c7e53f213621500e16c880 -importmap github.com/dustin/go-humanize=github.com/kubernetes-up-and-running/kuard/vendor/github.com/dustin/go-humanize -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./filters.go ./hashcolor.go ./template.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -complete -installsuffix static -buildid 755c570d28ece81ef1013d684cb1a637a7ba0e45 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./api.go ./config.go ./probe.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/app -complete -installsuffix static -buildid 7c4c9fc1ea1f2cf470f6f61dbe4f32ec57882ab7 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./app.go ./config.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/app.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a -trimpath $WORK -p main -complete -installsuffix static -buildid 9dedf95a963f34a56c86c3e078285ad04a2f82d6 -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./main.go
cd .
/usr/local/go/pkg/tool/linux_amd64/link -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out -L $WORK -L /data/go/pkg/linux_amd64_static -installsuffix static -extld=gcc -buildmode=exe -buildid=9dedf95a963f34a56c86c3e078285ad04a2f82d6 -X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.5-3-gb867e02-1 $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a
mkdir -p /data/go/bin/
cp $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out /data/go/bin/kuard
go install github.com/kubernetes-up-and-running/kuard/cmd/kuard: open /data/go/bin/kuard: permission denied
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

make build-amd64 VERBOSE=1 fails similarly.

$ LANG=C make build-amd64 VERBOSE=1
make --no-print-directory ARCH=amd64 build
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.5-3-gb867e02-1 -u $(id -u):$(id -g) -v kuard-build-data:/data -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard -v $(pwd)/bin/1/amd64:/data/go/bin -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64 -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
Verbose: 1
Building with VERBOSE
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.5-3-gb867e02-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
+ cd client
+ npm install --loglevel=error
+ npm run build

> client@1.0.0 build /data/go/src/github.com/kubernetes-up-and-running/kuard/client
> NODE_ENV=production webpack

Hash: 83005bbd70ef498c3be7
Version: webpack 1.15.0
Time: 10138ms
        Asset       Size  Chunks             Chunk Names
    bundle.js     316 kB       0  [emitted]  main
bundle.js.map  164 bytes       0  [emitted]  main
    + 263 hidden modules
+ go generate -x ./cmd/... ./pkg/...
go-bindata -pkg sitedata -prefix ../../sitedata/ -o bindata.go ../../sitedata/...
+ go install -x -installsuffix static -ldflags '-X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.5-3-gb867e02-1' ./cmd/...
WORK=/tmp/go-build223211911
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/sitedata -complete -installsuffix static -buildid c295c07b6aedeef71729c3e740bc61f45c84bf9a -importmap github.com/elazarl/go-bindata-assetfs=github.com/kubernetes-up-and-running/kuard/vendor/github.com/elazarl/go-bindata-assetfs -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/pkg/errors=github.com/kubernetes-up-and-running/kuard/vendor/github.com/pkg/errors -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./bindata.go ./doc.go ./sitedata.go
mkdir -p /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -complete -installsuffix static -buildid d30682a8c304174943c7e53f213621500e16c880 -importmap github.com/dustin/go-humanize=github.com/kubernetes-up-and-running/kuard/vendor/github.com/dustin/go-humanize -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./filters.go ./hashcolor.go ./template.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -complete -installsuffix static -buildid 755c570d28ece81ef1013d684cb1a637a7ba0e45 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./api.go ./config.go ./probe.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/app -complete -installsuffix static -buildid 7c4c9fc1ea1f2cf470f6f61dbe4f32ec57882ab7 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./app.go ./config.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/app.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a -trimpath $WORK -p main -complete -installsuffix static -buildid 9dedf95a963f34a56c86c3e078285ad04a2f82d6 -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./main.go
cd .
/usr/local/go/pkg/tool/linux_amd64/link -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out -L $WORK -L /data/go/pkg/linux_amd64_static -installsuffix static -extld=gcc -buildmode=exe -buildid=9dedf95a963f34a56c86c3e078285ad04a2f82d6 -X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.5-3-gb867e02-1 $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a
mkdir -p /data/go/bin/
cp $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out /data/go/bin/kuard
go install github.com/kubernetes-up-and-running/kuard/cmd/kuard: open /data/go/bin/kuard: permission denied
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make[1]: *** [bin/1/amd64/kuard] Error 1
rules.mk:67: recipe for target 'build-amd64' failed
make: *** [build-amd64] Error 2
zekefast commented 7 years ago

I'm having the same problem, you need a directory bin/kuard on the local host. Anyway if you want to keep moving with the book use docker pull gcr.io/kuar-demo/kuard-amd64:1 and you will download the image.

@rogerscuall Thanks for the workaround!

I fill kinda disappointed. Why do you need a book if you can not run examples from it?

I don't know would it help or not to mentione @kelseyhightower here as he is on of ther author of the book. Would be good to hear some suggestions from him about it.

brendandburns commented 7 years ago

Based on the errors I think your GOPATH/GOROOT environment variables are set incorrectly. You need to have them set to something in your local directory.

I'll have look okay the surrounding text and see if we need to do anything to clarify how to set these correctly.

--brendan


From: Zeke Fast notifications@github.com Sent: Sunday, November 12, 2017 12:26:09 PM To: kubernetes-up-and-running/kuard Cc: Brendan Burns; Mention Subject: Re: [kubernetes-up-and-running/kuard] Issue with initial dockerfile in KUAR chapter 2 (#7)

I'm having the same problem, you need a directory bin/kuard on the local host. Anyway if you want to keep moving with the book use docker pull gcr.io/kuar-demo/kuard-amd64:1 and you will download the image.

@rogerscuallhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frogerscuall&data=02%7C01%7Cbburns%40microsoft.com%7C8258faa4525c4222a59108d52a0b9c91%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636461151716270875&sdata=GvSK48Y6hk2tDaoudyHeT1xFkHaGXQg4pfvil81NWog%3D&reserved=0 Thanks for the workaround!

I fill kinda disappointed. Why do you need a book if you can not run examples from it?

I don't know would it help or not to mentione @kelseyhightowerhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkelseyhightower&data=02%7C01%7Cbburns%40microsoft.com%7C8258faa4525c4222a59108d52a0b9c91%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636461151716270875&sdata=DXSheLHFdL43KfMNB6Y0ZaAVt0wM0oxEneOGGjE4T3k%3D&reserved=0 here as he is on of ther author of the book. Would be good to hear some suggestions from him about it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes-up-and-running%2Fkuard%2Fissues%2F7%23issuecomment-343764784&data=02%7C01%7Cbburns%40microsoft.com%7C8258faa4525c4222a59108d52a0b9c91%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636461151716270875&sdata=tNxAzMe1PdWUvFMT%2FiT9P%2FadKgP%2FJbYwAlMY%2FNN8dhY%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFfDgslUdOu9P0TTJVprSmzyLAS0d-xAks5s11RhgaJpZM4P4vhO&data=02%7C01%7Cbburns%40microsoft.com%7C8258faa4525c4222a59108d52a0b9c91%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636461151716270875&sdata=d2rrFwU59V64S2ydJMmP3BJDBf0%2FX8gVf0N2PWaQrKA%3D&reserved=0.

dougireton commented 7 years ago

I get an error running make as well:

➜  kuard git:(master) ✗ make VERBOSE=1
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.6-1-g1fe8f05-dirty-1 -u $(id -u):$(id -g) -v kuard-build-data:/data -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard -v $(pwd)/bin/1/amd64:/data/go/bin -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64 -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.6-1-g1fe8f05-dirty-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
Verbose: 1
Building with VERBOSE
+ cd client
+ npm install --loglevel=error
./build/build.sh: line 47: npm: command not found
make: *** [rules.mk:135: bin/1/amd64/kuard] Error 1

Go Environment Vars

GOPATH="/Users/doug/go" GOROOT="/usr/local/Cellar/go/1.9.2/libexec"

drpalaric commented 6 years ago

What worked for me @iramsey85 is you fork the code, then when you're in the kuard directory, run make.

As @brendandburns mentioned, as long as your Go path is fine, it should work. If you're having issues with make, you also might try to re-fork the project and start over since you're at the beginning anyway. I wouldn't do the workaround because you don't really benefit from it - just keep on grinding out any issues.

After running make, you should see a bin folder. In that bin folder, you'll see there are three folders: 1, 2, and 3. Now, in your Dockerfile just substitute the following source and target with the COPY command:

COPY bin/1/amd64/kuard /kuard

Once that's done, you should be able to tag it, push it to your Docker Hub repo, and carry on!

jbeda commented 6 years ago

Updated the README to note this and provide more explicit documentation.

kokoluiso commented 6 years ago

My 2 cents: This is a book that k8s newbies will want to follow step by step, understanding each of those steps. There are a couple of things that are taken for granted that maybe could have been explained. This is my list:

  1. You have to create your own Dockerfile to build the image with the code provided in the book. However, the “MAINTAINER” command is actually deprecated. You should use LABEL maintainer=”x@x.com” instead
  2. You have to build the application before deploying (there is no “bin” directory). Start by installing Go.
  3. In order to build it, you have to run a “make build” command. If you are running MacOS that will fail because you need to install xcode first with: “xcode-select --install”
  4. The applications are not dropped in bin directory, but in bin/1/amd64/kuard, bin/2/amd64/kuard, bin/3/amd64/kuard
  5. Now you can see your image listed in repository kuard-amd64 with TAG 1 when you run “docker images”

Thanks.

brendandburns commented 6 years ago

Many thanks for the feedback we'll try to integrate it into the repo. (Or PRs are welcome :)

--brendan


From: kokoluiso notifications@github.com Sent: Wednesday, March 21, 2018 10:28:50 PM To: kubernetes-up-and-running/kuard Cc: Brendan Burns; Mention Subject: Re: [kubernetes-up-and-running/kuard] Issue with initial dockerfile in KUAR chapter 2 (#7)

My 2 cents: This is a book that k8s newbies will want to follow step by step, understanding each of those steps. There are a couple of things that are taken for granted that maybe could have been explained. This is my list:

  1. You have to create your own Dockerfile to build the image with the code provided in the book. However, the “MAINTAINER” command is actually deprecated. You should use LABEL maintainer=”x@x.commailto:x@x.com” instead
  2. You have to build the application before deploying (there is no “bin” directory). Start by installing Go.
  3. In order to build it, you have to run a “make build” command. If you are running MacOS that will fail because you need to install xcode first with: “xcode-select --install”
  4. The applications are not dropped in bin directory, but in bin/1/amd64/kuard, bin/2/amd64/kuard, bin/3/amd64/kuard
  5. Now you can see your image listed in repository kuard-amd64 with TAG 1 when you run “docker images”

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkubernetes-up-and-running%2Fkuard%2Fissues%2F7%23issuecomment-375184638&data=04%7C01%7Cbburns%40microsoft.com%7Ccf43502ef71147f7818008d58fb5cc28%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636572933337379072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=voA6Qd%2BTDIvSe99lGom4lzzaM0wG4XdqGUzUAJos2Fg%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFfDgvqU38BVt4THpBPgZUBQy0pAkx_Wks5tgzaSgaJpZM4P4vhO&data=04%7C01%7Cbburns%40microsoft.com%7Ccf43502ef71147f7818008d58fb5cc28%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636572933337379072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=K%2F4fndLiS4HuSPP%2BPuQKZ8CXO%2Fp1nfvRgj8j6oTL8IE%3D&reserved=0.

mamartinez724 commented 6 years ago

I agree with @kokoluiso comment, this is supposed to be a step by step tutorial, not a go and figure yourself why this is not working. As you mentioned, this is for newbies, After some research I found that "Go" (aka golang) is a language developed by Google I'm using ubuntu 16.04, so, I did

sudo apt install golang

This installed "Go"

Thanks for the tip @kokoluiso

mamartinez724 commented 6 years ago

Still doesn't work, of course, it couldn't be too easy

marco@notebook:~/k8s/kuard$ make
container: kuard-build
docker build                                                    \
    --rm                                         \
    -t kuard-build                                             \
    --build-arg "ALL_ARCH=amd64 arm arm64 ppc64le"                            \
    -f Dockerfile.build .                                         \
    >&1
Sending build context to Docker daemon 10.56 MB
Step 1/10 : FROM golang:1.7-alpine
 ---> 974aa102bae2
Step 2/10 : WORKDIR /data
 ---> Using cache
 ---> 80b9cb9b3c60
Step 3/10 : ENV GOPATH /data/go
 ---> Using cache
 ---> dd1337556f3b
Step 4/10 : ENV npm_config_cache /data/npm_cache
 ---> Using cache
 ---> f2f4ae09e901
Step 5/10 : ARG ALL_ARCH
 ---> Using cache
 ---> 313686ff736a
Step 6/10 : ENV ALL_ARCH ${ALL_ARCH}
 ---> Using cache
 ---> 3869a6a3039a
Step 7/10 : RUN for ARCH in ${ALL_ARCH}; do       ln -s -f "/data/std/${ARCH}" "/usr/local/go/pkg/linux_${ARCH}_static" ;     done
 ---> Using cache
 ---> ecac2b0e1a80
Step 8/10 : RUN apk update && apk upgrade && apk add --no-cache git nodejs bash
 ---> Using cache
 ---> ad33762bf327
Step 9/10 : RUN GOPATH=/tmp GOBIN=/usr/local/bin go get -u github.com/jteeuwen/go-bindata/...
 ---> Using cache
 ---> 9538be37a3f7
Step 10/10 : RUN GOPATH=/tmp GOBIN=/usr/local/bin go get github.com/tools/godep
 ---> Using cache
 ---> a9a429624c44
Successfully built a9a429624c44
docker volume create kuard-build-data >&1
kuard-build-data
docker volume create kuard-build-node >&1
kuard-build-node
docker run --rm                   \
    -v kuard-build-data:/data:delegated \
    -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules:delegated \
    -v $(pwd)/build:/build:delegated \
    -e TARGET_UIDGID=$(id -u):$(id -g)         \
    kuard-build                               \
    /build/init_data.sh                          \
    >&1
docker: Error response from daemon: invalid bind mount spec "/home/marco/k8s/kuard/build:/build:delegated": invalid mode: delegated.
See 'docker run --help'.
rules.mk:89: recipe for target '.kuard-build-container' failed
make: *** [.kuard-build-container] Error 125
marco@notebook:~/k8s/kuard$ docker version
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.6.2
 Git commit:   092cba3
 Built:        Thu Nov  2 20:40:23 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.6.2
 Git commit:   092cba3
 Built:        Thu Nov  2 20:40:23 2017
 OS/Arch:      linux/amd64
 Experimental: false
mamartinez724 commented 6 years ago

Ok, so after the research I did (which I wasn't expecting because this was supposed to be a step by step tutorial) this worked for me

sudo make build DOCKER_MOUNT_OPTION=

apparently docker CE doesn't like the DOCKER_MOUNT_OPTION or the "delegate" parameter, anyway. that command worked for me, again I'm using Ubuntu 16.04

@brendandburns Can you please update the documentation?

mamartinez724 commented 6 years ago

I tried to re-build from scratch to verify and it failed

I build successfully before, but I tried to document all the steps, so I started from scratch and now it's not working with a different error. This is what I did:

marco@notebook:~/k8s/kuard$ sudo make build DOCKER_MOUNT_OPTION
[sudo] password for marco: 
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.7.2-4-g423174b-dirty-1 -u $(id -u):$(id -g) -v kuard-build-data:/data -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard -v $(pwd)/bin/1/amd64:/data/go/bin -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64 -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
Verbose: 1
Building with VERBOSE
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.7.2-4-g423174b-dirty-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
+ cd client
+ npm install --loglevel=error
+ npm run build

> client@1.0.0 build /data/go/src/github.com/kubernetes-up-and-running/kuard/client
> NODE_ENV=production webpack

sh: webpack: Permission denied

npm ERR! Linux 4.13.0-37-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! client@1.0.0 build: `NODE_ENV=production webpack`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the client@1.0.0 build script 'NODE_ENV=production webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls client
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/go/src/github.com/kubernetes-up-and-running/kuard/client/npm-debug.log
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

By the way the same error appears after I installed npm and node.js using

sudo apt install npm 
sudo apt install npm node.js
mamartinez724 commented 6 years ago

Really is this code hardcoded to the /data directory? where is that specified in the book? Oh, yeah, in chapter 5, that's 3 chapter AFTER the build has to be done.

Can you please provide clear instructions on how to build your own example?

jbeda commented 6 years ago

I'll take a run at updating the instructions here this week some time if I can find a few minutes.

The build system for kuard is more complicated than many users would need as it has support for building 3 different psuedo-versions. The instructions in the book are more typical of what users will use.

Things are also complicated because not everyone is running a recent version of Docker. Newer versions of docker support features that make the build faster. I'm tempted to rewrite the builds here to use even new features like multi-stage builds.

FWIW, the hard coding to the /data directory is inside of the container. It is common to make assumptions about what is going on inside a container.

mamartinez724 commented 6 years ago

Thanks for responding,

I did some debugging and I finally got it to compile. I figured it out about the /data directory. I got stuck for a while with some permission issues on the npm part, but again more debugging I did changes to the Makefile:

REGISTRY <--- it was the tricky part, but after analyzing the rules.mk I noticed what was going on, de problem is that I have never done this before, so it took me a while to find out.

I knew at this point in the book kuard was just a binary to be added to the docker, but I really want to understand what was going on, plus later in the book you will do more stuff with it, so I need to have it working.

I just think you need to provide pre-reqs and describe what kuard does and how it's built, so people don't get frustrated.

Saludos Marco

On Mon, Mar 26, 2018, 12:26 PM Joe Beda, notifications@github.com wrote:

I'll take a run at updating the instructions here this week some time if I can find a few minutes.

The build system for kuard is more complicated than many users would need as it has support for building 3 different psuedo-versions. The instructions in the book are more typical of what users will use.

Things are also complicated because not everyone is running a recent version of Docker. Newer versions of docker support features that make the build faster. I'm tempted to rewrite the builds here to use even new features like multi-stage builds.

FWIW, the hard coding to the /data directory is inside of the container. It is common to make assumptions about what is going on inside a container.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes-up-and-running/kuard/issues/7#issuecomment-376226897, or mute the thread https://github.com/notifications/unsubscribe-auth/AfBAr0u3UyWRiGG8cpDAa1XIW2CIaQrFks5tiRbGgaJpZM4P4vhO .

--

Saludos

Marco

Sent from my android

mamartinez724 commented 6 years ago

Just to complete my comments and close my issue. This is exactly what I did and I checked it 3 times already, so far I'm a happy camper

Create a directory mkdir k8s To create the docker first kuard must be downloaded from github

        cd ~/k8s
    git clone https://github.com/kubernetes-up-and-running/kuard.git

Create a local registry

        docker rm $(docker ps -aq)
        docker rmi -f $(docker images -aq)
    docker pull registry
    docker run -d -p 5000:5000 --name localregistry registry

File changes

    Makefile
    #changed some parameter values

        REGISTRY ?= localregistry

        export VERBOSE ?= 1

        #Apparently docker CE doesn't like this parameter/value combo
        #DOCKER_MOUNT_OPTION ?= :delegated

Compile kuard sudo make build

histamineblkr commented 6 years ago

Following along the documentation here

[16:11 bauthier ~/.../Docker/kuard (master)]
$ make build
container: kuard-build
building : bin/1/amd64/kuard
sh: webpack: Permission denied

npm ERR! Linux 4.11.12-100.fc24.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! client@1.0.0 build: `NODE_ENV=production webpack`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the client@1.0.0 build script 'NODE_ENV=production webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls client
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/go/src/github.com/kubernetes-up-and-running/kuard/client/npm-debug.log
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

Now npm can have permission errors, but it does tell me this is likely a client package problem. What should I do now?

ghost commented 6 years ago

Hello

I've just tried to create the kuard container manually using docker. It fails with the message:

docker: Error response from daemon: invalid bind mount spec "kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules:delegated": invalid mode: delegated.

From the comments above I can see that this has caused problems for other people as well and I could not find the right answers from the developers/authors so far.

What I did to get the error:

  1. Clone
  2. cd into project
  3. sudo make build

My environment: Ubuntu Linux 16.04 docker version: Docker version 1.13.1, build 092cba3

Could you please provide your customers with the right solutions for this problem?

Thank you.

inevity commented 6 years ago

@histamineblkr on mac use sudo make build,not make build . sh: webpack: Permission denied disappare.

danpop-chainguard commented 6 years ago

Advice: spin up a gcp, azure, amazon, or vagrant (local) ubuntu instance. apt-get install nodejs, npm, and golang then set gopath/goroot or use this great script to (gohere: https://gist.githubusercontent.com/RobRuana/7cda375014e0f699fba1/raw/54ee5e707092affc3e39019c33b449debc4c8f4d/gohere) . after i did this vs compiling it directly on my Macbook Pro... all was right with the world.

GeorgeSapkin commented 6 years ago

On Fedora with SELinux enabled I had to specify :Z as DOCKER_MOUNT_OPTION in order to get make build to work:

sudo make build DOCKER_MOUNT_OPTION=:Z
hiranya911 commented 6 years ago

I'm also getting this error on Ubuntu.

container: kuard-build
building : bin/1/amd64/kuard
sh: webpack: Permission denied

npm ERR! Linux 4.15.0-33-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! client@1.0.0 build: `NODE_ENV=production webpack`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the client@1.0.0 build script 'NODE_ENV=production webpack'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     NODE_ENV=production webpack
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls client
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /data/go/src/github.com/kubernetes-up-and-running/kuard/client/npm-debug.log
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1

Does anybody know a fix/solution for Linux?

r0bwt191 commented 6 years ago

I am getting permission denied when Docker tries to pull down the kuard-build image. I went so far as signing up to gcr.io to see if I actually needed a login, but whilst I can see the kuar-demo images I still cannot access kuard-build (either because of permission issues or because it doesn't exist). Am I missing something here?

GeorgeSapkin commented 6 years ago

@r0bwt191 I think it's easier if you build it locally.

jbeda commented 5 years ago

I've reworked the Makefile. Hopefully that'll resolve the issue that folks are having. Closing this issue for now.