I start a docker like this:
`docker run --rm \
-e "http_proxy=${http_proxy}" \
-e "https_proxy=${https_proxy}" \
-e "GOPATH=/usr/src/myapp/.go" \
-v "${PWD}":/usr/src/myapp \
-v "${PWD}/build/foo/bin":"/foo" \
-w /usr/src/myapp \
golang:1.8 /bin/sh -c "ls -l /usr/src/myapp && ls -l /usr/src/myapp/build/foo/bin && cp /usr/src/myapp/build/foo/bin/foo /bin/ && make bin_build"`
One of my machines it works okay but when it runs from jenkins, it throws a strange output:
`ls: cannot access /usr/src/myapp/bar.go: Permission denied
total 0
-?????????? ? ? ? ? ? bar.go`
I suspect that some user access setting messes up the picture but I have not been able to find culprit or the solution yet. If anyone bumped into similar issue before I would appreciate his or her help.
It turned out that the Jenkins server was actually a CentOS where one does not simply attach a volume to docker... Using the following command however did the trick:
sudo chcon -Rt svirt_sandbox_file_t /host/folder/you/want/to/attach
Solution found in the following articles: