Comments (19)
I copied /usr/bin/local_build.sh out of the amazon/aws-codebuild-local:latest image, added a "sleep 10" to the beginning of the file, and then created a new docker image that inherits from amazon/aws-codebuild-local:latest image. I then modified codebuild_build.sh to use my image (amazon/aws-codebuild-local:bugfix) and tried again. This seemed to resolve my issue where docker inspect was given no arguments.
I would recommend adding some retry logic to avoid the race condition, and detecting that AGENT_ID is an empty string to make the error clearer.
from aws-codebuild-docker-images.
I encounter the same issue too, and i found the following by debug the container
bash-4.2# cat /proc/self/cgroup
12:rdma:/
11:blkio:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
10:net_cls,net_prio:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
9:hugetlb:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
8:perf_event:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
7:memory:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
6:pids:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
5:cpuset:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
4:freezer:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
3:devices:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
2:cpu,cpuacct:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
1:name=systemd:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
bash-4.2# head -n 1 /proc/self/cgroup
12:rdma:/
bash-4.2# FIRST_LINE=$(head -n 1 /proc/self/cgroup)
bash-4.2# echo $FIRST_LINE | awk -F'/' '{print $3}'
bash-4.2# echo $FIRST_LINE
12:rdma:/
bash-4.2# FIRST_LINE='11:blkio:/docker/b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953'
bash-4.2# echo $FIRST_LINE | awk -F'/' '{print $3}'
b6ae10461341ab05626e8e97eecbca3d4e84fd35765a2919d3e9a0b1cd09d953
bash-4.2# AGENT_ID=$(echo $FIRST_LINE | awk -F'/' '{print $3}' | cut -c 1-12)
bash-4.2# echo $AGENT_ID
b6ae10461341
The is following the local_build.sh and see which part is broken. It seem at the moment the script try to look up the current running docker agent ID by look up the /proc/self/cgroup, but for some reason the first line is not pointing to it. which end up AGENT_ID resolved to be empty string. if i manually run the command to use 2nd line, then it can get the AGENT_ID b6ae10461341 successfully
from aws-codebuild-docker-images.
FIRST_LINE=$(head -n 1 /proc/self/cgroup)
AGENT_ID=$(echo $FIRST_LINE | awk -F'/' '{print $3}' | cut -c 1-12)
export LOCAL_AGENT_IMAGE=$(docker inspect --format='{{.Config.Image}}' ${AGENT_ID})
This is the section of codes within local_build.sh unmodified.
I suggest the code maybe can change to something like this grep pids /proc/self/cgroup | awk -F'/' '{print $3}' | cut -c 1-12
from aws-codebuild-docker-images.
I have the same problem here.
from aws-codebuild-docker-images.
Hi, we also encounter this problem.
The command we run is the following.
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -e "IMAGE_NAME=aws/codebuild/nodejs:8.11.0" -e "ARTIFACTS=/home/baptiste/tmp" -e "SOURCE=/home/baptiste/workspace/gdc-app" -e "BUILDSPEC=/home/baptiste/workspace/gdc-app/.codebuild/buildspec-test.yml" amazon/aws-codebuild-local
"docker inspect" requires at least 1 argument.
See 'docker inspect --help'.
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
Removing network agentresources_default
Removing volume agentresources_user_volume
Removing volume agentresources_source_volume
Creating network "agentresources_default" with the default driver
Creating volume "agentresources_user_volume" with local driver
Creating volume "agentresources_source_volume" with local driver
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 68, in main
File "compose/cli/main.py", line 121, in perform_command
File "compose/cli/main.py", line 938, in up
File "compose/project.py", line 430, in up
File "compose/service.py", line 305, in ensure_image_exists
File "compose/service.py", line 325, in image
File "site-packages/docker/utils/decorators.py", line 17, in wrapped
docker.errors.NullResource: Resource ID was not provided
Failed to execute script docker-compose
from aws-codebuild-docker-images.
same here!
from aws-codebuild-docker-images.
You can fix this locally by apply my patch to the docker entry point with a docker file
But this require everyone who use this do the same too. Or you can distribute your own patches version
from aws-codebuild-docker-images.
Still having this issue after pulling the latest amazon/aws-codebuild-local:latest
from aws-codebuild-docker-images.
Just to confirm, are you using the shell script (https://github.com/aws/aws-codebuild-docker-images/blob/master/local_builds/README.md) or the expanded command as in the blog post?
from aws-codebuild-docker-images.
@subinataws I'm using the shell script, "freshly" downloaded from master. I also cloned this repo and built the ubuntu/docker/17.09.0
image.
This bug is intermittent. Restarting Docker (for Mac) usually helps. Will keep an eye out for more helpful information.
from aws-codebuild-docker-images.
I am also seeing this issue with 1.5.0.0:
./local_builds/codebuild_build.sh -i aws/codebuild/ubuntu-base -a artifacts -s source
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -e "IMAGE_NAME=aws/codebuild/ubuntu-base" -e "ARTIFACTS=artifacts" -e "SOURCE=src" amazon/aws-codebuild-local:latest
"docker inspect" requires at least 1 argument.
See 'docker inspect --help'.
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects
Removing network agentresources_default
Removing volume agentresources_user_volume
Removing volume agentresources_source_volume
Creating network "agentresources_default" with the default driver
Creating volume "agentresources_user_volume" with local driver
Creating volume "agentresources_source_volume" with local driver
Traceback (most recent call last):
File "bin/docker-compose", line 6, in <module>
File "compose/cli/main.py", line 68, in main
File "compose/cli/main.py", line 121, in perform_command
File "compose/cli/main.py", line 938, in up
File "compose/project.py", line 430, in up
File "compose/service.py", line 305, in ensure_image_exists
File "compose/service.py", line 325, in image
File "site-packages/docker/utils/decorators.py", line 17, in wrapped
docker.errors.NullResource: Resource ID was not provided
Failed to execute script docker-compose
from aws-codebuild-docker-images.
It seems like this might be a race condition. If I run
docker run -it -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint sh amazon/aws-codebuild-local:latest -c "docker ps | sed -n 2p | cut -c 1-12"
repeatedly, I get no output. However, if I add a short sleep:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock --rm --entrypoint sh amazon/aws-codebuild-local:latest -c "sleep 1; docker ps | sed -n 2p | cut -c 1-12"
d420fddac38d
I consistently get an ID.
from aws-codebuild-docker-images.
Thanks for posting the fix! It worked great. FYI - For the build I was using, the file path was /usr/local/bin/local_build.sh
instead of /usr/bin/local_build.sh
from aws-codebuild-docker-images.
FWIW, I put together some tooling that automates the fix suggested by @mc-allen in #73 (comment).
from aws-codebuild-docker-images.
I found another interesting facet to this: I have had codebuild running in cloud9 for a while, and just did an update today, only to run into this error. However, if I reboot the cloud9 instance, codebuild works exactly once, and then I run into this error until I reboot again.
from aws-codebuild-docker-images.
+1 for sinistral/aws-codebuild-local-73@32e2ef1
from aws-codebuild-docker-images.
I'm having the same issue.
from aws-codebuild-docker-images.
Hi! This is resolved in the latest version of the local agent. SHA: 78319d46f7d91ac1266640947ad1a7b3c2b7e2cb77a2b1601ba826f8b02ebc95
from aws-codebuild-docker-images.
Closing this issue. Please feel free to comment, if the issue persists.
from aws-codebuild-docker-images.
Related Issues (20)
- PHP 8.3 Support HOT 4
- local CodeBuild does not seem to perform caching
- aws/codebuild/standard:7.0-24.1.13 and 23.12.14 failing Lambda layer Makefile SAM build
- Docker 25 support HOT 14
- Please update glibc HOT 1
- Unable to run 'apt-get' on aws/codebuild/amazonlinux2-x86_64-standard:5.0 HOT 3
- Recent ARM image update has unintended side effects HOT 1
- Feature request: Golang 1.22 support HOT 1
- Add browsers to aws/codebuild/standard:7.0 HOT 1
- Amazon Linux:2023 image not available (CodeBuild, CodePipeline) HOT 1
- Add support for Node 21 HOT 1
- Update sam to version 1.110.0 HOT 1
- Feature Request: `dotnet8` Lambda compute image HOT 1
- aws/codebuild/standard:5.0 Build fails when file names have non english characters
- Please provide a new standard:8.0 image based on Ubuntu 24.04 (noble)
- update the version in docker-compose.yml files HOT 5
- Add `setfacl` tool
- Running npm the first time on `aws/codebuild/standard:7.0` takes 12 seconds HOT 3
- npm logs are retained in images
- [BUG] up: logPrinter panicked with "send on closed channel" #11280 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-codebuild-docker-images.