-
Notifications
You must be signed in to change notification settings - Fork 965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local Builds has problem with docker-in-docker-in-docker and source volume #76
Comments
Hi @piotrkubisa, You're correct in that the host's The tradeoff is that directories from the guest container cannot be mounted via We've filed this as a feature request for the ability to choose between the two behaviors. Thanks for reporting this! |
Any update (or workarounds) on this one? I have similar requirement to the OP. |
@micklove I guess you could just change the following line (remove volume share to
Edit: My bad, it won't work, because it will report problems with connecting to the docker service. I don't know any workaround to satisfy |
For our builds we need the code path mounted at minimum. I was able to resolve this by referencing the volume directly in compose, so we now have:
This is an ok-ish workaround for us for now, but we would like to see this implemented in a more intuitive/native way as we now have to parameterize a bunch of low level things to test builds locally which kind of blows the whole point of being able to build locally. |
FYI: For somebody still is interested in running a mimicked |
I get an exit status 2 when i run - docker run -v $(pwd)/target:/zap/wrk/:rw -t owasp/zap2docker-stable zap-full-scan.py -t $url -g gen.conf -r report.html in codebuild. Has there been any workaround yet? |
This doesn't seem to work for me. the
#/bin/bash
# Resolve source directory on the host because the local Codebuild agent uses the host's Docker daemon
sed "s|\${SOURCE_DIR}|/path/to/src/on/host|" codebuild.env.template > codebuild.env
# Run Codebuild locally
codebuild_build.sh -i aws/codebuild/standard:5.0 -s /path/to/src/on/host -e codebuild.env
...
phases:
build:
- |
if [ ! "${LOCAL_CODEBUILD}" = true ]
then
SOURCE_DIR="/path/to/src/in/container"
fi
... |
Docker-in-Docker-in-Docker sounds like fun. I am author of the localci which I unfortunately (also fortunately) developed few days before public release of AWS CodeBuild Local Builds. When I read blog post with announcement I was a bit sad but I attempted to finish it to learn how I can manage Docker containers using Golang. Thanks to it I have noticed there is the same problem I had during development
localci
.I wanted to prepare tough test for
localci
if mybuildspec.yml
will be parsed correctly and also will properly execute CodeBuild job as it would on production server. It usesaws/codebuild/docker:17.09.0
image and in phase there is a command to run a next Docker container (docker-in-docker-in-docker) with a shared volume to compile a Go binary (link to example).Frankly, it might not be complicated for no-gophers but I wanted tough test, huh? In AWS CodeBuild Local Builds it will report following error:
agent_1 | [Container] 2018/05/26 17:26:38 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: docker run --rm -v "$(pwd)":/gopath/src/${REPOSITORY_PATH} -w "/gopath/src/${REPOSITORY_PATH}" -e "GOPATH=/gopath" $DOCKER_IMAGE_GO sh -c "GOOS=linux GOARCH=amd64CGO_ENABLED=0 go build -a -v -o ./${BINARY_NAME} -ldflags \"-s -w -X main.buildVersion=${SOURCE_VERSION} -X main.buildDate=${CURRENT_DATETIME}\" $SOURCE_CODE". Reason: exit status 1
It seemed to me similar, because I had the same problem during development the
localci
- problem with shared volumes:Empty directory on guest-guest docker? It has also shed some light on the issue. In
localci
I had to remove the docker.sock as a shared volume (piotrkubisa/localcb@4d07874) between host and guest docker. Then I noticed everything started working just like CodeBuild in AWS cloud.Today, I tried to replace logic in
localci
to use AWS CodeBuild Local Builds instead of current state of art and I was also eager to try it after the announcement. Sadly, I need to move on to next project and wait for fixes. I look forward to updates in changelog related to this issue.The text was updated successfully, but these errors were encountered: