Hello,
I am used to build my docker images alpine based, e.g.: node:18-alpine
Now I have tried to use in my Dockerfile: registry.suse.com/bci/nodejs:18, because the one called: registry.opensuse.org/opensuse/bci/nodejs:latest is providing v20 only.
Now I get to my questions:
Is there another, smaller nodejs:18 image?
Should I use a busybox image and install nodejs and npm? If so, how?
Am I allowed to use registry.suse.com without subscription?
Any recommendations are highly appreciated.
Personally, I use the Alpine images from Docker hub directly. You certainly could build your own (I use the httpd:alpine image and layer some stuff on top of it using a Dockerfile). That does introduce extra maintenance to think about, as if the base image is updated, you need to rebuild your custom image; you can easily work around the extra maintenance by using the build service to update your images automatically, but I haven’t gotten around to setting that up for my images.
I don’t believe a subscription is required to use the SUSE registry; if there were, you wouldn’t be able to pull images without credentials and provisioned for that subscription.
Thanks for your answers.
Have you ever used the tiny bci busybox container images?
Or can someone explain how to install extra packages?
Should I better use the base images, since there is zypper included?
I have not.
The best way to do this is to build a dockerfile that installs them and builds you a new image. If you’re using the BCI images, though, the base image is the one you want, as zypper isn’t included in the busybox image. The busybox image appears to be for situations where you’re just overlaying files into the base image rather than needing to use the package manager.
That said, you can also just launch the container and use the package manager in the container to install whatever you want, but that will make rebuilding the image more difficult, since you’d have to do that each time you want to update the container. Using a Dockerfile is the recommended/preferred way of handling this for containers that you need to be able to upgrade and update.
1 Like
The SLE BCI containers from the SUSE registry can be used by anyone free of charge: Base Container Images (BCI) FAQ | SUSE and are distributed on registry.suse.com. They only contain the subscription-free SLE-BCI repository by default - you can add the openSUSE repositories with no issues, though you might want to use the Leap/Tumbleweed containers from registry.opensuse.org instead for this purpose, if you don’t mind a bigger base image.
The SLE BCI BusyBox image is a lightweight choice, but ships with neither zypper nor with RPM, see the comparison on Container Guide | Container Guide | SLE Base Container Images. Hence to use it as a base for an image containing additional packages, one can use a Kiwi template based build - easiest is using the Open Build Service, which will publish the resulting build on registry.opensuse.org for you.
3 Likes
Super, then I am on the right track.
At the moment there is no need for a Kiwi template based build, maybe later.
Thank you very much.
If someone is interested in getting nodejs:18 images apps to work.
Here is a Dockerfile where I containerize a nuxt3 app:
FROM registry.suse.com/bci/nodejs:18
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD [“node”, “.output/server/index.mjs”]
alternatively you may use openSUSE Leap as parent image for your layered image:
FROM registry.opensuse.org/opensuse/leap:latest
RUN set -eux; \
zypper refresh -b; \
zypper -n update; \
zypper -n install nodejs18 npm18; \
zypper clean --all
# other commands here
I see, but as @crameleon mentioned, it will result in a bigger base image.
Are there any advantages using the opensuse/leap:latest over the bci?
openSUSE Leap uses source from SLE, i think the size is (nearly) the same. This is the “leapnode:latest” that i built from Leap compared to bci/nodejs:18
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
leapnode latest 34a836f14bb5 41 seconds ago 253MB
registry.suse.com/bci/nodejs 18 79c9bebb794f 5 days ago 248MB
But as @crameleon mentioned, if your want a small/lightweight layered image, you may use SLE BCI Micro or BusyBox which is neither zypper nor with RPM shipped in the image.