Tutorial for container creation

Hi there,

I got interested in that project, had a look on what containers are available and liked it very much! But unfortnately some of the software I want to use is not available. Instead of filing a request I thought of contributing, but found no tutorial or brief explanation on what to do, which criteria to fullfill etc. I already had a look into s6-overlay, but found no explanation on what you are looking for in an container to release. Additionally I don’t even know if I’m up for that task.
Could you please give a little information about what to do, when I want to contribute, what things to master and where to find further information?


TL;dr: I want to contribute, what and how should I do it?

The easiest way is to pick a relatively simple image (perhaps duckdns) and look through its github repo. Let me give you some of the basic concepts and you should be able to figure out the rest. Feel free to stop by our discord to have a discussion or to ask questions.

The dockerfile is essentially the build instructions. It installs what’s necessary and sets various env variables and build arguments. At the end, it copies the /root folder contents into the image root.
The /root folder contains:

  1. Service files under /etc/services.d, which are managed by s6 and keep the processes active
  2. Init files under /etc/cont-init.d, which are run during container start and prepare the system for running the apps. Init files are executed and completed before services are started.
  3. Any app files or defaults

Also pay attention to the FROM line at the top of the dockerfile. All of our images use other baseimages (ubuntu or alpine) and some use another level of a baseimage on top of that (mono, nginx, etc.).

For instance duckdns uses alpine as the baseimage: https://github.com/linuxserver/docker-duckdns/blob/master/Dockerfile#L1
Which means all the init and service files from that baseimage will also be imported (during build of the baseimage): https://github.com/linuxserver/docker-baseimage-alpine

1 Like

Thanks for the fast answer!

I had a look into duckdns, it seems kind of clear. But I have another question:
I had a look into syncthing and it has neither a defaults nor an app directory. As far as I understand the app gets pulled in and built every time the container starts up. Also nextcloud. Or will the app be built from the dockerfile and then run? Where are the persistend storage drives mounted? Or ist the user expected to do it?

Syncthing is a somewhat complicated one because it has a 2 staged build. The first stage in the dockerfile compiles the app, the second stage retrieves the compiled bin from the first stage and copies it to /usr/bin: https://github.com/linuxserver/docker-syncthing/blob/master/Dockerfile#L57 But all of that happens during build from dockerfile, not container start.

Nextcloud on the other hand is very unique. Because nextcloud has various steps it needs to do during an update, we install it during container start (first time only), but if it’s already installed we don’t touch the existing install. The user is expected to upgrade via web gui so nextcloud can process all the necessary steps.

1 Like

Okay, so it is not as straightforward as I thought.
How is data of the apps stored? As far as I understand the container gets recreated with each update. But user data should persist. Where is that stored?

We always set it to the /config mapping

Did you have any luck @funnym0nk3y? I’m in the same boat as you. Trying to figure out a way to build containers in a way that would contribute. Working with linuxserver.io containers has taught me so much, this weekend I’m going to use drone.io to start working on a ci for container creation.

@PatSki Unfortunately no. I did not get the stuff with S6. My understanding of LSIO was, that it tries to provide a unified container architecture through S6. As there are no tutorials, explanations or a wiki the general idea is a little cloudy.
Did you have any luck with drone.io?

I explained it all above. Was that not clear?

To be honest, CI is the last thing, pretty sure we all build containers locally when making them, then when we know everything is working it goes into CI.

Just quicker (at least I find)

Late to the party. Starting to figure out how to use your lsiobase images. Starting with alpine, I managed to rebase one of my simpler containers to your lsiobase/alpine image.

@funnym0nk3y @PatSki Maybe looking at my basic usage of their image, you can learn something more. It’s very basic/simple, nothing complicated, but it’s a start. Specifically the lsiobase/alpine branch