Docker exec -i image_name /bin/bash not working

Hi,

I am unable to open a shell inside my running container with the docker exec option. When I attempt to I receive the following error.

username@colibri-imx6:~$ docker exec -i my_image /bin/bash
http: invalid Host header

It appears I am able to run all other docker commands and it is just exec that is having this issue.

I am using a custom carrier board with the following setup:

  • Colibri iMX6DL 512MB IT
  • Kernel 5.4.264-5.7.5-devel+git.0dae0c54feaf

I built an image following the Build TorizonCore from Source With Yocto Project/OpenEmbedded process using the containerized TorizonCore Build method and WSL2. The build had the following arguments:

  • MANIFEST=dunfell-5.x.y
  • MACHINE=colibri-imx6
  • DISTRO=torizon-upstream
  • IMAGE=torizon-core-docker-colibri-imx6-Tezi_5.4.0+build.10

I have made a few small changes to the final image (username, fstab etc.)

The docker version info is as follows:

username@colibri-imx6:~$ docker version
Client:
 Version:           19.03.15-ce
 API version:       1.40
 Go version:        go1.14.15
 Git commit:        f60dc77833
 Built:             Tue Feb 13 00:26:38 2024
 OS/Arch:           linux/arm
 Experimental:      false

Server:
 Engine:
  Version:          19.03.15-ce
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.14.15
  Git commit:       f60dc77833b563cb54a6798e5bf6efd02aba048b
  Built:            Thu Jan  1 00:00:00 1970
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          v1.2.14-3-g3b3e9d5f6.m
  GitCommit:        3b3e9d5f62a114153829f9fbe2781d27b0a2ddac.m
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f-dirty
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683-dirty

I have seen this question Docker hello_world not running (and the github discussions on the issue) which appears to be related to my issue but I am having difficulty understanding how to implement the proposed solution.

Let me know if there is any more info required.

Any advice you could offer to overcome this would be very welcome.

Cheers,
Neil

EDIT/UPDATE**
I have tried to run the Toradex pre-built container with libgpiod installed found in the How to use gpio on torizoncore document and (I assume) due to the “-it” options included I have received the same error.

Greetings @Neilm,

I’m unable to reproduce this myself. Using docker exec works as expected for me. Though I am using our out of the box 5.7.2 stable release. If you use this version do you still have this issue?

That said, I also tested on the very latest 5.7.6 nightly image and the behavior seems fine here as well. Perhaps some change you did on the Yocto level caused this?

Best Regards,
Jeremias

Thanks for the quick response @jeremias.tx

I believe the only Yocto level changes I made were the ones suggested by you in this other forum question, Build Torizon OS with custom username and password, though I will double check this and also have a go building 5.7.2 with my changes to see if this works.

Cheers,
Neil

I see. Well if you only made changes related to adding a new user, then this shouldn’t affect anything with Docker. Could you also check if you get this error with just the standard 5.7.2 image we provide with no modifications.

Best Regards,
Jeremias

Hi @jeremias.tx,

Just a quick update. I have rebuilt everything from scratch making incremental changes to see what was the cause of the issue and of course everything worked this time. I can only assume I must have accidentally made some typo/error in my initial build.

Thanks for your help with this.

Cheers,
Neil

Glad to hear you were able to work things out!