aws-sam-cli: Running `sam build --use-container` on Travis fails to download Docker image
Description
The amazon/aws-sam-cli-build-image-python3.7
Docker image cannot be downloaded on Travis while running sam build --use-container
. This issue doesn’t happen on macOS Catalina (10.15.5) and Ubuntu Eoan (19.10).
The docker pull amazon/aws-sam-cli-build-image-python3.7
works okay everywhere and if we download it explicitly in this way on Travis, the sam build --use-container
will do its job.
Source: https://github.com/BR0kEN-/aws-sam-cli--build-travis Example build: https://travis-ci.com/github/BR0kEN-/aws-sam-cli--build-travis/builds/176709868
Steps to reproduce
The https://github.com/BR0kEN-/aws-sam-cli--build-travis was created especially to reproduce the behavior.
Observed result
See the build results at https://travis-ci.com/github/BR0kEN-/aws-sam-cli--build-travis/builds/176709868.
Expected result
The sam build --use-container
should download Docker image on Travis.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Ubuntu 16.04.6 LTS on Travis only. Works okay on the same version inside of the VirtualBox.
sam --version
: 1.0.0
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 20 (3 by maintainers)
We have a proposed fix for this that we’re working on. It will not require an upgrade to the SAM CLI, as the issue would be with the images themselves.
This seems does not depend on the runtime type and happens to all of them. See https://travis-ci.com/github/BR0kEN-/aws-sam-cli--build-travis/builds/177681130.
I didn’t experience such issue. Looks weird since the
boto3
is the dependency ofaws-sam-cli
.@BR0kEN- Exactly the same in the Bitbucket cloud: Cannot be reproduced anywhere else.
I supposed that it is linked with:
I have setup a workaround image here: https://hub.docker.com/repository/docker/tobwiens/aws-sam-cli-build-image-python3.7-fix2125/general
I added
RUN chown -R root:root /var && chown -R root:root /THIRD-PARTY-LICENSES.txt
at the end of the docker file. A search withfind / \( -uid 1230228 \) -ls 2>/dev/null
reveals no files with that UUID anymore. Though the same errorfailed to register layer: Error processing tar file(exit status 1): Container ID 1230228 cannot be mapped to a host ID
persists inside the bitbucket pipeline.I am afraid that is two different issues @tobwiens.
In this run https://travis-ci.com/github/BR0kEN-/aws-sam-cli--build-travis/jobs/363879074, you can find
docker pull "amazon/aws-sam-cli-build-image-$SAM_RUNTIME"
that downloadsamazon/aws-sam-cli-build-image-python3.7:latest
.The problem I have in a nutshell:
sam build --use-container
doesn’t work on Travis since 1.0.0.docker pull "amazon/aws-sam-cli-build-image-$SAM_RUNTIME"
beforesam build --use-container
helps to avoid the above problem.Before the
sam:1.0.0
I was usingsam:0.53.0
and the Docker images were https://hub.docker.com/r/lambci/lambda instead of https://hub.docker.com/r/amazon.The above issues result in a very similar error message that I see -
RuntimeError: Container does not exist. Cannot get logs for this container
.