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…

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.

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 :

2 Likes