[Docker] Docker containers and management in YunoHost!

Hello everybody,
I have made several experimental YunoHost apps around Docker. The reason behind is that some apps I liked were not yet implemented in YunoHost (or were too difficult to implement) so for the time being I felt back to Docker.

I would love to hear your feedbacks and tests. Do not hesitate to fork/commit/fix bugs.
Thanks

Introduction

What is Docker?

  • Docker is a program that “virtualize” applications so that they can be run separately
  • Docker allows easy deployment of a wide range of web applications that might not be yet implemented in YunoHost: See http://registry.hub.docker.com

Why would you want to use Docker in YunoHost?

  • Because your favorite app is not yet implemented in YunoHost or would be too difficult to implement
  • Because you like to keep your apps separated to avoid breaking your YunoHost install

Why would you NOT want to use Docker in YunoHost?

  • If you already use Docker and have installed YunoHost in its own container: This app works ONLY if YunoHost is installed in the host (see this link if you want to try anyway)
  • If YOU KNOW WHAT YOU ARE DOING
  • If you want a flawless YunoHost experience with Single Sign-On, as Docker containers are not integrated with YunoHost

So here are the apps!

DockerUI for YunoHost https://github.com/scith/dockerui_ynh

This application installs Docker along with DockerUI for easy container and images management
http://techblog.bigdata-analyst.de/content/images/2014/Apr/Bildschirmfoto-2014-04-24-um-17-35-23.png

Docker Containers for YunoHost https://github.com/scith/docker_container_ynh

This multi-instance application allows to create Docker containers from within YunoHost (and manage them as services). It also installs Docker if it has not been installed yet, so it is independent from DockerUI (which is just here to facilitate management of pulled images)

  • The image can be pulled from the official registry: http://registry.hub.docker.com
  • Any options can be passed to the container (eg ports, volumes…)
  • The container is manageable through the YunoHost Services page
    (tested with Debian Jessie & Yunohost 2.2) or with “sudo service
    container-name start/stop/status”
  • The container can be mounted with a dedicated volume from the host
  • This app is multi instances, meaning that you can create as many containers as you want
  • It is however recommended to install the DockerUI package for a finer management of containers and images
  • Adventurous users could try to install the experimental app Shipyard for an even more advanced management of containers

Experimental feature:

  • Create a YunoHost app from the container (redirects ports to domain/path with SSO)

To be done:

  • Backup and restore containers with YunoHost moulinette

Docker and Shipyard for YunoHost: https://github.com/scith/docker_shipyard_ynh

This app installs Docker along with Shipyard. It is not working very well yet and has to be set up manually. It also opens a port on your Docker host which could create a security flaw. Highly experimental but once working, it could be much more powerful than DockerUI (manage clusters of Docker hosts, create containers…)

To illustrate how powerful this could be, I created a template you can use to deploy your own Dockerized apps in YunoHost and also an example (RStudio app) :smile:

Template for Dockerized YunoHost apps: https://github.com/scith/docker_template_ynh

This is a template that will allow you to deploy a Dockerized YunoHost app quickly and efficiently. The container can be started/stopped via the Services menu of YunoHost.
Just fork it and get started!
I still need to add some options and fix some stuff though.

This template has been successfully applied to the Dockerized RStudio app: https://github.com/scith/docker_rstudio_ynh

This is the RStudio application (web application to develop with R statistics). I never managed to get it working with YunoHost so here is the Dockerized version…

2 Likes

I also made another app to create YunoHost apps out of your Docker containers:

Redirect_ynh: https://github.com/scith/redirect_ynh

With this app you can redirect one path to a YunoHost domain/path and app (with or without SSO).
For example, a container running with the option “-p 127.0.0.1:8080:80” could be redirected to “http://domain.tld/myapp/” with SSO.

2 Likes

Hi @scith,

thanks for your work! Since I saw your post, I’m excited, I finally managed to find time to discuss with you!

Before starting the discussion, I have to tell you my secret long term plan to dominate the world with free software:

Make IndieHosters as easy as yunohost (nice webui, sso) but with the power of docker and socket activation to be able to host large farms of servers to host users services almost for free.
I met yunohost in Paris last May with this dream. We didn’t manage to agree on a specific format to package apps, but a lot of interesting discussions (like SSOwhat :slight_smile: ).
And so your project is a kind of a bridge!

Here is the specification for IndieHosters packages: https://github.com/indiehosters/applications/
Here is an example with odoo app: https://github.com/indiehosters/odoo

What do you think we start to collaborate on that?
Benefit for yunohost:

Benefit for IndieHosters:

  • share the work to maintain these images

What do you think?
Tell me what I can do to help you :smile:
(I can change my spec to use minor case scriptname like backup :slight_smile: )

Hello @pierreozoux and thanks for getting in touch :smile:

I am not 100% clear on what your project is about, but I’m sure we’ll find ways to collaborate. I’ll drop you on email and we’ll take it from there!

Also please know that I’m about to launch a similar service so there might be synergies to consider.

Cheers,
Jean-François

Hello,
I would try but works only on 64 bit system :cry:

Sorry, that has to do with Docker I think. I’m not sure I can do anything about it at the moment :cry:

Psycows, are you trying to use it on arm by any chance?

Yes Scith, on arm 32 bits.

Thanks… I’ll see if I can make some of my scripts compatible with ARM by using this trick: https://community.scaleway.com/t/getting-started-docker-on-c1-armhf/383

sed -i 's|^FROM |FROM armbuild/armhf-|g' Dockerfile

I might perhaps clone the Docker repository, then replace the base image by an ARM base image and rebuild the image…
But this looks complex so it might not be done right now.

Hi,
Thanks a lot ! That’s what I was looking for.

I had to change the dockerui path because I had the problem : Error: image dockerui/dockerui not found
The solution was to change your script with kevan/dockerui instead of dockerui/dockerui.

I forked it and changed it here : https://raw.githubusercontent.com/pmietlicki/dockerui_ynh

Please if you could change that, I will poste an issue on your github project.

Thanks again, I’m looking forward to using your shipyard implementation.

Best regards,
Pascal

Hi,
Thanks for your help. I’ll change into the main repo. I have stopped the shipyard YNH development because I did not have the use of it. Feel free to fork if you wish to continue the development: https://github.com/scith/docker_shipyard_ynh

Also I still have to refresh these Docker packages to be up to the latests YunoHost specs (notably the backup/restore, which I haven’t managed to make work with Docker yet)

Cheers

I noticed the functions are not working anymore. Is there a plan to upgrade them?

It will be of great help and will expand the current app-limitation of yunohost.

For people ending on this topic : note that there is this “meta package” which supposedly can convert a docker image to a level-7 yunohost app

Dunno if it still works, but maybe worth checking out :

6 Likes

is it still the case that yunohost apps that run within docker will not receive “official” status or have there been any exceptions?

Hello guys!

Any update on this? We are currently working on our Ansible collection (Ansible collection:Ansible Yunohost V1.1.1 is out!🎉 Let's contribute!) on Docker and would like to know if any of the apps mentioned above are still usable?

Otherwise, in any case we would like to implement a new feature to easily deploy Docker apps with Docker Compose and integrate the app into YunoHost user panel.
Do you guys would be interested? Any feedback or suggestions?

Thanks :slight_smile:

2 Likes

Hey !

I think that would be pretty cool, there’s definitely a bunch of use case for this which are currently not well-covered by other possibilities (eg we usually end up telling people to manually deploy their docker then use the redirect_ynh app to expose it)

A bunch of random notes :

  • The generator-dockerapp-yunohost repo was pretty impressive at the time, but had a bunch of caveats or “not-super-clean” practices inside it … e.g a curl | bash to install docker which is debatable, not properly removing docker-ce when the app got removed, etc …
  • I saw multiple times docker-ce causing issues and effectively “blocking” apt because for some reason the service restart starts crashing at some point and prevent the dpkg-configure to complete etc … this is pretty annoying but i don’t know the cause of the issue exactly é_è
  • The ~new config panel mechanism could be useful to build a sort of minimalist portainer-like stuff … though it really depends how you imagine the stuff would work / what is the use case exactlym and as I write this, I realize this may not be relevant in an ansibled paradigm :sweat_smile:
  • There are multiple way to approach this:
    • for example there’s this concept of “a meta-app that can be used to generate yunohost app from a Dockerfile / docker-compose”, similar to generator-dockerapp-yunohost
    • an actual yunohost app in which you could select a Dockerfile / docker-compose.yml file upon installation (the ability to have “file” argument during install is kinda recent) and configure additional stuff in a config panel
    • a portainer-like app to handle multiple dockers ?
    • ???
4 Likes

EN :uk:

Hello @Aleks,

Thanks for all these informations.

I work with @alexutadotlinux5733 on the design of the Ansible Yunohost collection.

Our goal is to facilitate the installation, configuration and security of YNH instances through automation via Ansible. All this while following the best practices of the DevOps movement, of which I am one of the French popularizers.

Our current use case is to be able to install containerized applications on a YunoHost server when they are not available in the managed applications catalog.

For example our use case is the following: at Lydra we need to install Ara or Zammad on our tools server managed by YunoHost. For the moment we are going with the idea of making a docker service composed behind a redirect_ynh application.

For our collection we are in the case where it is the user of this collection who configure Ansible and not in the case where a user uses the YNH interface to install a container. It’s on this usage that we would like to have some feedback or ideas.

It is also possible that we propose to install portainer, I don’t know it well enough to know how it manages the exposure of containerized services.

FR :fr:

Bonjour @Aleks,

Merci pour toutes ces pistes.

Je travail avec @alexutadotlinux5733 Arthur sur la conception de la collection Ansible Yunohost.

Notre objectif est de faciliter l’installation, la configuration et la sécurisation des instances YNH grâce à l’automatisation via Ansible. Le tout en suivant les bonnes pratiques du mouvement DevOps dont je suis un des vulgarisateurs en français.

Notre cas d’usage actuel est de pouvoir installer des applications conteneurisés sur un serveur YunoHost quand elles ne sont pas disponible dans le catalogue d’applications pacagés.

Par exemple notre cas d’usage est le suivant : chez Lydra nous avons besoin d’installer Ara ou Zammad sur notre serveur des outils géré par YunoHost. Nous ne voulons pas multiplier les serveurs pour faire des économies d’énergie, c’est mieux pour la planète.

Pour le moment nous sommes partit sur l’idée de faire un service docker compose derrière une application redirect_ynh.

Pour notre collection nous sommes dans le cas ou c’est l’utilisateur de cette collection qui configure Ansible et pas dans le cas ou un utilisateur utilise l’interface YNH pour installer un conteneur. C’est donc sur cette usage là que l’on aimerai avoir des retours de besoins ou des idées.

Il est possible aussi que l’on propose d’installer portainer, je ne le connait pas assez bien pour savoir comment il gère l’exposition des services conteneurisés.

I would like to know what is the satus of this. What is the simplest easiest way to deploy apps dockerized?

The current status quo is basically “install your Docker stuff manually, then install redirect_ynh using the reverse proxy mode to actually expose your app”

2 Likes