Issue with TorizonCore builder

Hello all,

I keep getting the following error while trying to use the docker-compose.yml to bundle my docker container

This is the command I use:

torizoncore-builder --bundle-directory bundled_containers bundle -f docker_compose.yml --platform linux/arm64 --host-workdir $(pwd)

Output

An unexpected Exception occured. Please provide the following stack trace to
the Toradex TorizonCore support team:


Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/docker/api/client.py", line 259, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://127.0.0.1:22376/v1.40/images/create?tag=latest&fromImage=bba_app_arm64v8-debian-python3_bullseye_release_437ef37d-0975-42f4-b754-b77135cf72f9&platform=linux%2Farm64

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/builder/torizoncore-builder", line 131, in <module>
    mainargs.func(mainargs)
  File "/builder/tcbuilder/cli/bundle.py", line 24, in bundle_containers
    platform=args.platform, output_filename=common.DOCKER_BUNDLE_FILENAME)
  File "/builder/dockerbundle.py", line 277, in download_containers_by_compose_file
    image = dind_client.images.pull(image, platform=platform)
  File "/usr/local/lib/python3.7/dist-packages/docker/models/images.py", line 445, in pull
    repository, tag=tag, stream=True, **kwargs
  File "/usr/local/lib/python3.7/dist-packages/docker/api/image.py", line 415, in pull
    self._raise_for_status(response)
  File "/usr/local/lib/python3.7/dist-packages/docker/api/client.py", line 261, in _raise_for_status
    raise create_api_error_from_http_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
    raise cls(e, response=response, explanation=explanation)
docker.errors.ImageNotFound: 404 Client Error: Not Found ("pull access denied for bba_app_arm64v8-debian-python3_bullseye_release_437ef37d-0975-42f4-b754-b77135cf72f9, repository does not exist or may require 'docker login': denied: requested access to the resource is denied")

Can someone please help to identify the issue?

Regards,
Gaurav

Greetings @gauravks,

The “bundle” command should use a docker in docker container to pull the container images as specified by the supplied docker-compose.yml. It then packs these images up in a tarball.

Judging by the error produced it seems perhaps the tool doesn’t have access to the specified container images. Where are these images on dockerhub? Or were they not pushed to any container registry yet?

Best Regards,
Jeremias

@jeremias.tx I have pushed them to docker hub in a private repository. How do I specify the credentials for the docker login in this case?

Ok yeah it turns out the tool doesn’t have the ability to access such private repositories that require credentials. Unfortunately “docker login” won’t work for this case. This is because the to bundle the tool uses a “Docker in Docker” container to pull and bundle the specified images. Unfortunately the “Docker in Docker” has it’s own docker daemon and can’t access the credentials of the host docker daemon it seems. Let me bring this up to the team we’ll need to figure out a way to securely pass such credentials.

Thank you for bringing this lack of functionality to our attention.

Best Regards,
Jeremias

Hello Jeremias.

What is the status of this issue? I just bumped on the same problem, but for the moment I can work with my repos as public.
What if I need to have a private repo?

Greetings @adrmateu,

This feature has been added to TorizonCore Builder since this post was created. Please see the command manual here: TorizonCore Builder Tool - Commands Manual | Toradex Developer Center

You’ll want to use the --login argument in order to access a private Docker Hub registry.

Best Regards,
Jeremias

2 Likes

Hello Jeremias,
Thanks for the answer.
Indeed, the --login parameter is present when called with the bundle command, but it does not exists for the build command, unless I am mistaken.

Best regards,
Adrian

Hi @adrmateu,

For build command you can specify the login details for the private repository directly in the config file under the bundle tag of the output section. TorizonCore Builder Tool “build” command | Toradex Developer Center

    bundle:
      compose-file : docker-compose.yml
      username : <DOCKER_USER>
      password : <DOCKER_PASS>

Just to affirm, @gauravks is correct here. Those are the correct parameters you want to look at for the build command.

Yep!! That’s true. Thanks!!!

Glad that help clear things up.