Torizoncore-builder bundle fails with "insecure" http registry

I’m struggling to bundle the docker images to Torizin with torizoncore-builder bundle. I have the image (called gaia_m) at the local registry. The registry is serving HTTP not HTTPS. Now the bundle command seems not to be able to handle this.

When I’m trying to run the command I get this error:

rahiram@fioulci1:~/temppitest/gaia-torizon-deployment/compose_configs/m_box$
torizoncore-builder bundle
–host-workdir=$(pwd) --platform=linux/arm/v7 --file docker-compose.yml 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.9/dist-packages/docker/api/client.py”,
line 268, in _raise_for_status
response.raise_for_status() File “/usr/local/lib/python3.9/dist-packages/requests/models.py”, line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500
Server Error: Internal Server Error
for url:
https://127.0.0.1:22376/v1.40/images/create?tag=latest&fromImage=172.23.224.52%3A5000%2Fgaia_m&platform=linux%2Farm%2Fv7

During handling of the above
exception, another exception occurred:

Traceback (most recent call last):
File “/builder/torizoncore-builder”,
line 172, in
mainargs.func(mainargs) File “/builder/tcbuilder/cli/bundle.py”,
line 22, in bundle_containers
dockerbundle.download_containers_by_compose_file(
File “/builder/dockerbundle.py”, line
281, in
download_containers_by_compose_file
image = dind_client.images.pull(image,
platform=platform) File
“/usr/local/lib/python3.9/dist-packages/docker/models/images.py”,
line 446, in pull
pull_log = self.client.api.pull( File
“/usr/local/lib/python3.9/dist-packages/docker/api/image.py”,
line 430, in pull
self._raise_for_status(response) File
“/usr/local/lib/python3.9/dist-packages/docker/api/client.py”,
line 270, in _raise_for_status
raise create_api_error_from_http_exception(e)
File
“/usr/local/lib/python3.9/dist-packages/docker/errors.py”,
line 31, in
create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server
Error for
https://127.0.0.1:22376/v1.40/images/create?tag=latest&fromImage=172.23.224.52%3A5000%2Fgaia_m&platform=linux%2Farm%2Fv7:
Internal Server Error (“Get
https://172.23.224.52:5000/v2/: http:
server gave HTTP response to HTTPS
client”)

However, I can make it run by changing the /builder/dockerbundle.py a bit. I do that by creating my own dockger image out of the torizon/torizoncore-builder:2 image. Like this:

FROM torizon/torizoncore-builder:2

RUN sed -i -e ‘s/dind_client = manager.get_client()/dind_client = docker.from_env()/’ /builder/dockerbundle.py

As you see, I just simply override your docker client definition with simple docker.from_env(). This creates the bundle without errors. However, I have not tested yet if it works properly on the target.

Would be great to have this working out of the box.

One more thing. Do you have the dockerfile for torizoncore-builder and contained python codes available as open source somewhere?

Greetings @ramirahikkala,

Thank you for reporting this issue and also even coming up with a potential fix! Please allow us some time to test and incorporate your fix on our side. Also if you have any changes or notice anything about the solution you proposed please let us know.

Do you have the dockerfile for
torizoncore-builder and contained
python codes available as open source
somewhere?
Currently we do not have it open-sourced. However this is a good idea and I see no reason why we shouldn’t. Let me bring this up with the team. Anyways the python source is viewable in the container like you’ve shown, so it’s not like anything is hidden anyways.

Thank you again for the fix I’ll try and remember to inform you when it’s been officially published.

Best Regards,
Jeremias