Before I get into the meat of today's topic, first here is a link to the GnuSocial instance I am running inside a docker container. With that out of the way, let us get straight into the article.

I recently took up the task of creating a fully dockerized GnuSocial instance. Effectively building a full LAMP stack inside a container. That is the container contains,

  • L: Alpine Linux
  • A: Apache (Although I'm actually using lighty)
  • M: Mysql/MariaDB
  • P: PHP

Although the LAMP Stack is baked into the container itself, I do plan on abstracting (which wont be hard at all) it out and making a LAMP container, this will allow me to easily host applications based on a lamp stack.

The GnuSocial image repo can be found here, it includes building instructions, something which is outside the scope of this post. Its not 100% complete yet, as the entry-point is not as refined as I would like it to be (I do 1 or 2 things that are kind of scuffed with regards to the DB). Also there are many packages not needed which easily increase the size of the image by ~150mb. Another annoying issue is the fact that ssl seems to not play well with GnuSocial, but I suspect that may be something on my end, as when connecting through https all css is lost and the page basically freaks out. Hence why its currently only running on http.

The final issue (Which should be fixed soon). when creating the image, as sometimes the database takes longer that 15 seconds to start up, in which case the GnuSocial user is not created and the database for GnuSocial is not created, if this does occur then one must simply run,

$ docker exec -it <container name> sh
$ echo "CREATE DATABASE social;" | mariadb
$ echo "GRANT ALL on social.* TO 'social'@'localhost' IDENTIFIED BY 'social';" | mariadb

With the above done, you can actually begin the install. If you have the container running and have attached <port> to the internal port 4000 of the docker container, then one must simply go to http://localhost:<port>/ and follow the instructions from there. Once completed, you can access your GnuSocial instance from http://localhost:<port>/.

This was my second time creating my own Docker image. The first being when I created an image for the cmesg server, the image can be found here. These first two images where my first direct attempts at creating docker images (although I have a lot of experience using other peoples images). Hence there may be one or two mistakes or I may have done something in a rather obtuse manner. I do plan on tidying up these images to remove any bloat.