Torizoncore-builder bundle "can't determine container ID"

Colibri iMX8DX V1.0D

I have a docker image at “hub.docker.com”. When executing “torizoncore-builder bundle” i get the response “can’t determine current container ID”

What are the solutions to resolve this?

Thanks

Hi @CEK ,

Can you give more details regarding the error that you’ve encountered?

  • What are the steps that you’ve done before seeing the issue?
  • What is the exact torizoncore-builder bundle command that you’ve used?
  • Can you post the complete error message, like the entire Python traceback (if that is the case)?

Best regards,
Lucas Akira

Below is the contents of my tcbuild.yaml.

<img width=“624” height=“336” style=“width:6.5in;height:3.5in” id=“Picture_x0020_2” src=“/uploads/default/original/2X/9/9a123e9d5828ef0217a0cb357d9a2db3b9a4727e.png” alt="Text

Description automatically generated">

When I issue command “torizoncore-builder build”, which references tcbuild.yaml, it indicates “Can’t determine current container ID”

<img width=“624” height=“187” style=“width:6.5in;height:1.9479in” id=“Picture_x0020_3” src=“/uploads/default/original/2X/9/96ef205bee5df36a8dc06facbaa1646ba88466ba.png” alt="Text

Description automatically generated">

You might have an outdated TorizonCore Builder setup script. Can you try removing tcb-env-setup.sh, download it again using

wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh

source it, check for updates, then try running torizoncore-builder bundle to see if it works?

Best regards,
Lucas Akira

I removed [tcb-env-setup.sh](http://tcb-env-setup.sh), I then executed `wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh```

``

After executing Torizoncore-builder build I get the same result: “can’t determine current container ID”

I can’t seem to reproduce this error. On my Linux and Windows machine this process seems to work just fine.

After using the setup script what is your output for alias torizoncore-builder?

I removed [tcb-env-setup.sh](http://tcb-env-setup.sh), I then executed `wget https://raw.githubusercontent.com/toradex/tcb-env-setup/master/tcb-env-setup.sh```
``

Just to confirm you then re-sourced the new setup script after wget right?

Also on what OS/setup are you running TorizonCore Builder on?

If I recall you use Windows/WSL, correct? What WSL distro do you use?

Best Regards,
Jeremias

  • The output for “alias torizoncore- builder” is as follows:

(command) ~/tcbworkdir/TorizonCoreBuild$ alias torizoncore-builder

(reply) alias torizoncore-builder=‘docker run --rm -it -v /deploy -v “$(pwd)”:/workdir -v storage:/storage -v /var/run/docker.sock:/var/run/docker.sock $(tcb_dynamic_params) torizon/torizoncore-builder:3’

  • I did re-source the new script after wget, I restarted PC also

  • The OS/set-up is Windows/WSL and the OS is as follows:

(command) ~/tcbworkdir/TorizonCoreBuild$ cat /etc/os-release

(reply) NAME=“Ubuntu”

VERSION=“20.04 LTS (Focal Fossa)”

ID=ubuntu

ID_LIKE=debian

PRETTY_NAME=“Ubuntu 20.04 LTS”

VERSION_ID=“20.04”

HOME_URL=https://www.ubuntu.com/

SUPPORT_URL=https://help.ubuntu.com/

BUG_REPORT_URL=https://bugs.launchpad.net/ubuntu/

PRIVACY_POLICY_URL=https://www.ubuntu.com/legal/terms-and-policies/privacy-policy

VERSION_CODENAME=focal

UBUNTU_CODENAME=focal

(command) ~/tcbworkdir/TorizonCoreBuild$ wsl.exe -l --running

(reply)Windows Subsystem for Linux Distributions:

Ubuntu-20.04 (Default)

docker-desktop-data

docker-desktop

Your alias looks correct and you’re not using a strange distro or setup, as far as I can tell.

We’ll need to do a bit more involved debugging then to figure out what’s wrong since we can’t reproduce this ourselves.

First of all please run this command:

docker run --rm -it -v /deploy -v "$(pwd)":/workdir -v storage:/storage -v /var/run/docker.sock:/var/run/docker.sock $(tcb_dynamic_params)  --entrypoint="/usr/bin/env" torizon/torizoncore-builder:3

And return the full output.

Then run, this command:

torizoncore-builder --log-level debug bundle docker-compose.yml (targeting your docker-compose file of course)

And return the full output of this as well, even if the command fails in your case return the full output.

Best Regards,
Jeremias

Here is the commands and replys:

/tcbworkdir/TorizonCoreBuild$ docker run --rm -it -v /deploy -v “$(pwd)”:/workdir -v storage:/storage -v /var/run/docker.sock:/var/run/docker.sock $(tcb_dynamic_params) --entrypoint=“/usr/bin/env” torizon/torizoncore-builder:3

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/builder

HOSTNAME=505752d7ffa4

TERM=xterm

TCB_CONTAINER_NAME=tcb_1656705457

HOME=/root

tcbworkdir/TorizonCoreBuild$ torizoncore-builder --log-level debug bundle docker-compose.yml

2022-07-01 20:08:58,960 - docker.utils.config - DEBUG - Trying paths: [‘/root/.docker/config.json’, ‘/root/.dockercfg’]

2022-07-01 20:08:58,960 - docker.utils.config - DEBUG - No config file found

2022-07-01 20:08:58,960 - docker.utils.config - DEBUG - Trying paths: [‘/root/.docker/config.json’, ‘/root/.dockercfg’]

2022-07-01 20:08:58,961 - docker.utils.config - DEBUG - No config file found

2022-07-01 20:08:58,976 - urllib3.connectionpool - DEBUG - http://localhost:None “GET /version HTTP/1.1” 200 None

2022-07-01 20:08:58,979 - urllib3.connectionpool - DEBUG - http://localhost:None “GET /v1.41/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22name%22%3A+%5B%22tcb_1656706137%22%5D%7D HTTP/1.1” 200 None

2022-07-01 20:08:58,984 - torizon.tcbuilder.backend.common - WARNING - couldn’t determine ID of container (container name method)

2022-07-01 20:08:58,986 - urllib3.connectionpool - DEBUG - http://localhost:None “GET /v1.41/containers/json?limit=-1&all=0&size=0&trunc_cmd=0 HTTP/1.1” 200 None

2022-07-01 20:08:58,988 - root - ERROR - Can’t determine current container ID.

2022-07-01 20:08:58,989 - root - DEBUG - Traceback (most recent call last):

File “/builder/torizoncore-builder”, line 213, in

mainargs.func(mainargs)

File “/builder/tcbuilder/cli/bundle.py”, line 94, in do_bundle

bundle(bundle_dir=args.bundle_directory,

File “/builder/tcbuilder/cli/bundle.py”, line 46, in bundle

host_workdir = common.get_host_workdir()

File “/builder/tcbuilder/backend/common.py”, line 456, in get_host_workdir

container_id = get_own_container_id(docker_client)

File “/builder/tcbuilder/backend/common.py”, line 449, in get_own_container_id

raise OperationFailureError(“Can’t determine current container ID.”)

tcbuilder.errors.OperationFailureError: Can’t determine current container ID.

This is very strange the environment variable TCB_CONTAINER_NAME=tcb_1656705457 is being set properly inside the builder container, but it still fails with that error. Which should not be happening.

In this part of the code the builder tool is trying to interact with the Docker API running on your host machine. The only thing I can think that’s wrong at this point is something is different about how Docker is configured on your machine compared to what we’ve tested with.

With that said, how is Docker configured on your machine?

  • What version of Docker Desktop do you have installed on your machine?
  • You only have Docker Desktop installed, correct? You don’t have something strange where you have Docker engine/Docker Desktop also installed in WSL?
  • What are your Docker Desktop settings? (settings → Docker Engine).

As a sanity check you could try re-installing Docker Desktop completely just to make sure there’s no weird non-default settings that may have been changed.

Best Regards,
Jeremias

I did get bundle to successfully execute on another PC set up with WSL, etc.

To answer your questions:

On the 1st machine where I receive “Can’t determine current container id” Docker is not installed in WSL as indicated below

The Docker version on the machine where I receive “Can’t determine current container id”. Docker was uninstalled and installed again

Docker settings on PC where I receive “Can’t determine current container id”

Docker settings on machine where I can successfully execute bundle with “Torizoncore-builder build”

I don’t know why the settings in docker engine are different and i don’t know if it makes a difference.

thanks

Huh that’s interesting, so there’s two things that might be the cause here. Either the issue is related to the different Docker Desktop settings. Or it’s related to the different Docker Desktop versions.

Let’s try this. Copy the settings from the machine where bundle worked and transfer these settings to the machine where bundle failed. Most notably I recall in the past we’ve had issues with some machines where buildkit was enabled.

If after having the same settings your first machine still fails to execute bundle the issue might be the Docker Desktop version. But I’m not sure how we’d go about confirming this.

Best Regards,
Jeremias

I copied the “Settings - Docker Engine” contents (as shown in earlier reply) from the working machine to the non-working machine and it made no difference. I still receive “Can’t determine current container ID”

If it’s not the settings then it must be some other configuration or possibly the version.

On my setup I updated Docker Desktop to the latest version which is 4.10.1 (this is apparently the latest I’m not sure how Docker does their versioning scheme). My settings are as follows:

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "debug": false,
  "experimental": false,
  "features": {
    "buildkit": false
  },
  "insecure-registries": [],
  "registry-mirrors": []
}

With all this bundle executes successfully on my machine. You can try to compare and see if anything at all differs in your setup. It might also be worth just re-installing Docker Desktop to see if that helps at all. Otherwise it’s not very obvious to me why bundle is failing on one of your machines.

Best Regards,
Jeremias