Closed Mahesha999 closed 3 months ago
Hi!
Indeed the bash slices are missing for focal. I added a PR: https://github.com/canonical/chisel-releases/pull/103. Hopefully, it will get merged soon! After that, you should be able to install the bash (and coreutils if you need) slices.
Regarding your questions, I can tell you that the chisel-releases repository is far from complete. Ideally, you would figure out what packages you may need to build your chiselled application container since there is an emphasis on size. Then, see if the relevant slices are in the repo; if not, PRs are more than welcome! Please note that, you may not need to wait for the PRs to get merged, you can chisel the slice using your changes in your chisel-releases fork. (chisel cut--release
option is useful for this.) But it's always best to get the PR merged through reviews.
Bash can be included using this slice
chisel cut --release ubuntu-${UBUNTU_RELEASE} --root /rootfs coreutils_bins coreutils_libs bash_bins
Thanks for the comment @tuapuikia .
@Mahesha999 I hope this is no longer an issue for you. But please feel free to re-open if needed.
I created docker image for my app using official
ubuntu:20.04
docker image as base image. It consumed 300 MBs. I started exploring if I can reduce the image size further I came across chiesel by canonical. Following are some tutorial / links regarding chiesel. 1, 2, 3, 4. 5, 6 So, I started preparing distroless ubuntu 20.04 image for my app using chisel.I tried following dockerfile:
I was able to build above image. But it contained empty file system. I realised that I need at least bash. But then I found that there is no chisel slice for bash for ubuntu 20.04 as can be cheched here. There is one for ubuntu 22.04 as can be checked here.
So I tried source bash from other ubuntu library as follows:
I was able to build this image. But, I got following error while building my app image using above image as base image:
I guess, it now contains
bash
but now does not containadd-apt-repository
. Do I need to copy this library too to my base image? I then quickly went through my app dockerfile based onubuntu:20.04
image. It contained various other commands likeapt
,apt-get
,add-apt-repository
,chmod
,cd
. Do I have to copy them individually from other base image the way I am copyingbash
from ? Also, for my app, I am cloning various third party libraries and then running their files. Those files themselves might require other ubuntu commands.Q1. Do I have to copy all such required commands from other base image?
This will be tedious since I will come to know what all things I required as and when image build fails. Then add
COPY
command to dockerfile and rebuild the image. So I want to know the recommeded procedure to build the distroless image for my app.Q2. Also, is it fine to install libraries using
apt-get install
while building distroless image or it basically makes it not-so-distroless? If I should not be usingapt-get
to build distroless image, then how should I install all necessary dependency packages?PS: The second image does not contain the bash also. I get following error while running it:
Same for
/usr/bin/bash
: