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)

  1. OS: Ubuntu 16.04.6 LTS on Travis only. Works okay on the same version inside of the VirtualBox.
  2. sam --version: 1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 20 (3 by maintainers)

Most upvoted comments

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.

Running into the same issue with python 3.6.

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.

Additionally, when using the pre-downloaded container to run tests with sam local invoke, I had to explicitly include boto3 in my custom dependency manifest file when running sam build.

I didn’t experience such issue. Looks weird since the boto3 is the dependency of aws-sam-cli.

@BR0kEN- Exactly the same in the Bitbucket cloud: Cannot be reproduced anywhere else.

I supposed that it is linked with:

Docker user namespace configurations are stored within the following two files ‘/etc/subuid’ and ‘/etc/subgid’, which looks as follows on Bitbucket Pipelines (https://jira.atlassian.com/browse/BCLOUD-17319?error=login_required&error_description=Login+required&state=8ed7d80a-9e08-407f-9a65-ed972944869e)

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 with find / \( -uid 1230228 \) -ls 2>/dev/null reveals no files with that UUID anymore. Though the same error failed 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 downloads amazon/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.
  • The explicit docker pull "amazon/aws-sam-cli-build-image-$SAM_RUNTIME" before sam build --use-container helps to avoid the above problem.

Before the sam:1.0.0 I was using sam: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.