slim icon indicating copy to clipboard operation
slim copied to clipboard

how to keep shell environment included with slim

Open wang2024666 opened this issue 1 year ago • 2 comments

Expected Behavior

keep shell env after slim build


Actual Behavior

we run with shell include as: docker-slim --report /root/slim.report.json build --http-probe=false --continue-after=1 --include-shell=true --include-oslibs-net=true --include-ssh-client=true ndsmodeler:20240914 the contiainer seems still missing the shell environment. [root@localhost ~]# docker exec -it caf51e6fff9d /bin/bash OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown [root@localhost ~]# docker exec -it caf51e6fff9d /bin/sh OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown [root@localhost ~]# docker exec -it caf51e6fff9d sh OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown how can we keep the shell environment and basic os commands? the base image is CentOS Stream 8

Specifications

  • Version: 1.40.11
  • Platform: centos stream 8

wang2024666 avatar Sep 20 '24 08:09 wang2024666

@wang2024666 thank you for the report! This looks a bit strange... Definitely need to investigate it more. In the meantime, try using the --include-bin and/or --include-exe flags. Also try using the latest release

kcq avatar Sep 23 '24 00:09 kcq

@wang2024666 thank you for the report! This looks a bit strange... Definitely need to investigate it more. In the meantime, try using the --include-bin and/or --include-exe flags. Also try using the latest release @kcq we tried the latest release with: mint slim
--http-probe=false
--continue-after=1
--include-bin=/bin/bash \ (must with this flag, we can get the bash) --include-shell=true
--include-oslibs-net=true
--include-ssh-client=true
ndsmodeler:20240914 then run the image, the bash is included, docker exec -it f5e0cf56476a /bin/bash bash-5.1# ls
bash: ls: command not found bash-5.1# cd /app bash-5.1# ls bash: ls: command not found bash-5.1# dir bash: dir: command not found bash-5.1# ll bash: ll: command not found bash-5.1# pwd /app bash-5.1# ls bash: ls: command not found bash-5.1# ping bash: ping: command not found bash-5.1# cat bash: cat: command not found but other basic commands like ls, cat, ping not in the image now. should we keek all the bin files one by one or other flags can be used?

wang2024666 avatar Sep 23 '24 02:09 wang2024666