iximiuz / cdebug

cdebug - a swiss army knife of container debugging
https://iximiuz.com/en/posts/docker-debug-slim-containers/
Apache License 2.0
1.23k stars 47 forks source link

chroot: can't execute '/bin/sh': No such file or directory #23

Closed jeffbrl closed 4 months ago

jeffbrl commented 4 months ago

Thanks for writing this software.

When attempting to connect to caddy-docker-proxy container, I get an error. Environment is Rocky Linux 9.3 VM on ESXi server (64 bit Intel).

[jeffl@portainer10 ~]$ cdebug -v
cdebug version 0.0.16 (built: 2024-02-18T15:19:35Z commit: 3a7b9f64339229e0bf3ca2bf55b5e724ef851b5e)
[jeffl@portainer10 ~]$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock lucaslorentz/caddy-docker-proxy:2.8.10
7b92cc877f5af3c12a8f14e249f255bd3a3534b69c074ec20b8a5f606535a072
[jeffl@portainer10 ~]$ cdebug exec -ti 7b92cc877f5
chroot: can't execute '/bin/sh': No such file or directory
[jeffl@portainer10 ~]$
iximiuz commented 4 months ago

Interesting! The exec command works just fine if you specify the shell explicitly:

$ cdebug exec -ti <container_id> sh
/ # 
/ # ps auxf
PID   USER     TIME  COMMAND
    1 0         0:00 /bin/caddy docker-proxy
   56 0         0:00 sh /.cdebug-entrypoint.sh
   65 0         0:00 sh
   66 0         0:00 ps auxf

It's a regression from the recent batch of changes. However, instead of reverting the change, I'll try merging #12 tomorrow - in particular, it should fix it.

iximiuz commented 4 months ago

Fixed in 0.0.17. Thanks for reporting!

jeffbrl commented 4 months ago

Much appreciated. I really enjoy your newsletter, blog articles, and labs. Keep up the great work.