Git Product home page Git Product logo

Comments (19)

mc-allen avatar mc-allen commented on July 17, 2024 1

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.

jk2l avatar jk2l commented on July 17, 2024

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.

jk2l avatar jk2l commented on July 17, 2024
    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.

omar-nahhas avatar omar-nahhas commented on July 17, 2024

I have the same problem here.

from aws-codebuild-docker-images.

bgaillard avatar bgaillard commented on July 17, 2024

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.

pete911 avatar pete911 commented on July 17, 2024

same here!

from aws-codebuild-docker-images.

jk2l avatar jk2l commented on July 17, 2024

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.

klausbadelt avatar klausbadelt commented on July 17, 2024

Still having this issue after pulling the latest amazon/aws-codebuild-local:latest

from aws-codebuild-docker-images.

subinataws avatar subinataws commented on July 17, 2024

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.

klausbadelt avatar klausbadelt commented on July 17, 2024

@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.

mc-allen avatar mc-allen commented on July 17, 2024

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.

mc-allen avatar mc-allen commented on July 17, 2024

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.

JNazare avatar JNazare commented on July 17, 2024

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.

rascalking avatar rascalking commented on July 17, 2024

FWIW, I put together some tooling that automates the fix suggested by @mc-allen in #73 (comment).

from aws-codebuild-docker-images.

everyplace avatar everyplace commented on July 17, 2024

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.

jonnolen avatar jonnolen commented on July 17, 2024

+1 for sinistral/aws-codebuild-local-73@32e2ef1

from aws-codebuild-docker-images.

jasondebolt avatar jasondebolt commented on July 17, 2024

I'm having the same issue.

from aws-codebuild-docker-images.

awszhen avatar awszhen commented on July 17, 2024

Hi! This is resolved in the latest version of the local agent. SHA: 78319d46f7d91ac1266640947ad1a7b3c2b7e2cb77a2b1601ba826f8b02ebc95

from aws-codebuild-docker-images.

subinataws avatar subinataws commented on July 17, 2024

Closing this issue. Please feel free to comment, if the issue persists.

from aws-codebuild-docker-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.