Skip to content

Commit 74faa7a

Browse files
authored
Added 'docker login' to fix pull rate limit issue (#5)
1 parent 9fd926b commit 74faa7a

10 files changed

+86
-0
lines changed

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ Then,
158158
* to run integration tests: `make test-integ`
159159
* to run smoke tests: `make test-smoke`
160160

161+
### Troubleshooting
162+
While running integration tests, you might encounter the Docker Hub rate limit error with the following body:
163+
```
164+
You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limits
165+
```
166+
To fix the above issue, consider authenticating to a Docker Hub account by setting the Docker Hub credentials as below CodeBuild environment variables.
167+
```shell script
168+
DOCKERHUB_USERNAME=<dockerhub username>
169+
DOCKERHUB_PASSWORD=<dockerhub password>
170+
```
171+
Recommended way is to set the Docker Hub credentials in CodeBuild job by retrieving them from AWS Secrets Manager.
161172
## Security
162173

163174
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.

test/integration/codebuild/buildspec.os.alpine.1.yml

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ phases:
3737
- >
3838
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3939
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
40+
- >
41+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
42+
then
43+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
44+
else
45+
echo "Performing DockerHub login . . ."
46+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
47+
fi
4048
- echo "Building image ${IMAGE_TAG}"
4149
- >
4250
docker build . \

test/integration/codebuild/buildspec.os.alpine.2.yml

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ phases:
3939
- >
4040
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
4141
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
42+
- >
43+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
44+
then
45+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
46+
else
47+
echo "Performing DockerHub login . . ."
48+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
49+
fi
4250
- echo "Building image ${IMAGE_TAG}"
4351
- >
4452
docker build . \

test/integration/codebuild/buildspec.os.alpine.3.yml

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ phases:
3939
- >
4040
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
4141
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
42+
- >
43+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
44+
then
45+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
46+
else
47+
echo "Performing DockerHub login . . ."
48+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
49+
fi
4250
- echo "Building image ${IMAGE_TAG}"
4351
- >
4452
docker build . \

test/integration/codebuild/buildspec.os.amazonlinux.yml

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ phases:
3737
- >
3838
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3939
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
40+
- >
41+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
42+
then
43+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
44+
else
45+
echo "Performing DockerHub login . . ."
46+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
47+
fi
4048
- echo "Building image ${IMAGE_TAG}"
4149
- >
4250
docker build . \

test/integration/codebuild/buildspec.os.centos.1.yml

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ phases:
3636
- >
3737
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3838
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
39+
- >
40+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
41+
then
42+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
43+
else
44+
echo "Performing DockerHub login . . ."
45+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
46+
fi
3947
- echo "Building image ${IMAGE_TAG}"
4048
- >
4149
docker build . \

test/integration/codebuild/buildspec.os.centos.2.yml

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ phases:
3636
- >
3737
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3838
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
39+
- >
40+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
41+
then
42+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
43+
else
44+
echo "Performing DockerHub login . . ."
45+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
46+
fi
3947
- echo "Building image ${IMAGE_TAG}"
4048
- >
4149
docker build . \

test/integration/codebuild/buildspec.os.debian.yml

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ phases:
3636
- >
3737
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3838
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
39+
- >
40+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
41+
then
42+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
43+
else
44+
echo "Performing DockerHub login . . ."
45+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
46+
fi
47+
- >
48+
echo "RUN apt-get update && apt-get install -y curl" >> \
49+
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
3950
- echo "Building image ${IMAGE_TAG}"
4051
- >
4152
docker build . \

test/integration/codebuild/buildspec.os.ubuntu.1.yml

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ phases:
3535
- >
3636
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3737
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
38+
- >
39+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
40+
then
41+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
42+
else
43+
echo "Performing DockerHub login . . ."
44+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
45+
fi
3846
- echo "Building image ${IMAGE_TAG}"
3947
- >
4048
docker build . \

test/integration/codebuild/buildspec.os.ubuntu.2.yml

+8
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ phases:
3434
- >
3535
echo "COPY ${SCRATCH_DIR}/aws-lambda-rie /usr/bin/aws-lambda-rie" >> \
3636
"${SCRATCH_DIR}/Dockerfile.echo.${OS_DISTRIBUTION}.tmp"
37+
- >
38+
if [[ -z "${DOCKERHUB_USERNAME}" && -z "${DOCKERHUB_PASSWORD}" ]];
39+
then
40+
echo "DockerHub credentials not set as CodeBuild environment variables. Continuing without docker login."
41+
else
42+
echo "Performing DockerHub login . . ."
43+
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
44+
fi
3745
- echo "Building image ${IMAGE_TAG}"
3846
- >
3947
docker build . \

0 commit comments

Comments
 (0)