From d97f4d82bd0d46da055bd5fc1ce82f7bb4dd01a4 Mon Sep 17 00:00:00 2001 From: "Hyang-Ah (Hana) Kim" Date: Tue, 13 Jan 2015 20:21:01 -0500 Subject: [PATCH] mobile: docker run should require a $GOPATH/src volume mount. If the volume is not accessible or -v option is not given, docker run golang/mobile will fail with an error like: finalize namespace chdir to /src/golang.org/x/mobile no such file or directory2015/01/13 20:14:19 Error response from daemon: Cannot start container dfe1dbc2bac3ea939e154eee13d20ecae4c473a595dbc1e6a0e5cf0be3963909: finalize namespace chdir to /src/golang.org/x/mobile no such file or directory Change-Id: I4d56c044e9c7682e63da7170a546522230237b18 Reviewed-on: https://go-review.googlesource.com/2780 Reviewed-by: Burcu Dogan --- Dockerfile | 3 +++ README.md | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/Dockerfile b/Dockerfile index a7ae52a..f0a13dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,6 +59,9 @@ RUN curl -L https://github.com/golang/go/archive/master.zip -o /tmp/go.zip && \ ./all.bash && \ CC_FOR_TARGET=$NDK_ROOT/bin/arm-linux-androideabi-gcc GOOS=android GOARCH=arm GOARM=7 ./make.bash +# Expect the GOPATH/src volume to be mounted. (-v $GOPATH/src:/src) +VOLUME ["/src"] + # Generate a debug keystore to avoid it being generated on each `docker run` # and fail `adb install -r ` with a conflicting certificate error. RUN keytool -genkeypair -alias androiddebugkey -keypass android -keystore ~/.android/debug.keystore -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 365 diff --git a/README.md b/README.md index ae05994..fbea3f1 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,10 @@ To build, run: docker run -v $GOPATH/src:/src mobile /bin/bash -c 'cd /src/your/project && ./make.bash' +Note the use of -v option to mount $GOPATH/src to /src of the container. +The above command will fail if the -v option is missing or the specified +volume is not accessible from the container. + When working with an all-Go application, this will produce a binary at `$GOPATH/src/your/project/bin/name-debug.apk`. You can use the adb tool to install and run this app. See all.bash for an example.