How to create my own Docker?


Recommended Posts

I would like to create a Docker for this project: https://github.com/thoukydides/heatmiser-wifi - at the moment I have it running in a VM based on Ubuntu Server 14 which seems like a huge overkill for something simple as this.

 

However, I never built a Docker before but am eager to learn. From what I understand I need a base image, then get the required stuff from the above link working (Git, Pearl, Pearl Packages, Upstart) inside the image, then use other Dockers for the database (MariaDB) and web server (Apache) and finally make all of them work together nicely.

 

Is there a guide on how best to do this to make it work on unRAID? Or a general easy to follow guide on how to build a Docker like this from scratch?

 

Any help would be very much appreciated, thanks a lot.

Link to comment

Thanks very much, that's a good idea. Any other tips on how to start, like which base image to use? Does it have to be Ubuntu-based, or would any of the other (smaller) ones would work better? Is there a guide specifically for unRAID or can I gust follow any guide on building a Docker image?

Link to comment

personally, i'd put the apache element and the app itself in one container, use a mariadb or mysql container for the database element, and don't use upstart in a container..

 

This.

 

Also for baseimage look at phusion\baseimage.

Link to comment

Thanks very much, that's a good idea. Any other tips on how to start, like which base image to use? Does it have to be Ubuntu-based, or would any of the other (smaller) ones would work better? Is there a guide specifically for unRAID or can I gust follow any guide on building a Docker image?

 

There are some 'best practices' appearing on these forums for unRAID Dockers but I can't for the life of me figure why they'd want to depart from the standard Docker thinking. As I keep saying, Docker is just a packaging mechanism and is completely platform agnostic (or should be if done right). Basically what I'm saying is, any Docker guide will do. Docker is Docker, even on unRAID.

Link to comment

Docker is Docker, even on unRAID.

 

That is essentially true, but there are certains things that if implemented can make a docker more suitable for unraid, uid and gid being the main one, using the TZ variable (passed with the bind time feature from the template) in containers where timezones are important is another, although the TZ variable can be passed manually from the comnand line of course on non-unraid boxes.

Link to comment

Docker is Docker, even on unRAID.

 

That is essentially true, but there are certains things that if implemented can make a docker more suitable for unraid, uid and gid being the main one, using the TZ variable (passed with the bind time feature from the template) in containers where timezones are important is another, although the TZ variable can be passed manually from the comnand line of course on non-unraid boxes.

 

If you're building a container you're on the command line anyway...

Link to comment

Docker is Docker, even on unRAID.

 

That is essentially true, but there are certains things that if implemented can make a docker more suitable for unraid, uid and gid being the main one, using the TZ variable (passed with the bind time feature from the template) in containers where timezones are important is another, although the TZ variable can be passed manually from the comnand line of course on non-unraid boxes.

 

If you're building a container you're on the command line anyway...

 

if you're the only person using it.......

Link to comment

personally, i'd put the apache element and the app itself in one container, use a mariadb or mysql container for the database element, and don't use upstart in a container..

 

If I can't use UPSTART in a container, what should I do to run a daemon instead?

 

runit (if you're going with phusion baseimage or supervisor if you're not, or if the app and runit don't get on together)

 

sometimes to get the command to use in either (and this doesn't always work) i edit the upstart or init file and change the exec in the exec line to echo and run it from a command line inside the container.

Link to comment

And how do I get my own Docker container loaded into my unRAID system?  :-[

 

 

depends if you want to share it or just use it yourself (selfish, lol)

 

make a git repository for the dockerfile and ancillary files like startup routines and config files etc.....

 

then use dockerhub automated build linked to that repo.

 

then make a template repo and an xml file for it

 

 

 

container repo example

 

https://github.com/sparklyballs/docker-containers

 

template repo example

 

https://github.com/sparklyballs/docker-repo/tree/templates/Sparklys-Repo

 

announce the repo in the main docker thread and squid will pick it up and put it in the community applications plugin and his thread on repos.

 

BUT

 

if you're going to be selfish, lol....

 

just do the build on your unraid box and you'll get a docker image appear in your docker tab, providing you've setup a docker.img file

Link to comment
  • 2 years later...
On 7/6/2015 at 2:39 PM, sparklyballs said:

just do the build on your unraid box and you'll get a docker image appear in your docker tab, providing you've setup a docker.img file

So...for the docker inept (outside of using CA to get and install dockers) can you explain how to do the build on unraid?  Do I need to navigate to a specific folder?  Any specific commands to get the image where it's supposed to be?  Can you explain more about "providing you've setup a docker.img file"?  Is that the one that exists on the system if I'm using dockers or will that be a docker image for the docker file I'm building?

Link to comment
20 minutes ago, NeoMatrixJR said:

So...for the docker inept (outside of using CA to get and install dockers) can you explain how to do the build on unraid?  Do I need to navigate to a specific folder?  Any specific commands to get the image where it's supposed to be?  Can you explain more about "providing you've setup a docker.img file"?  Is that the one that exists on the system if I'm using dockers or will that be a docker image for the docker file I'm building?

Been a while since I played with any of this, but everything docker related the unRAID webUI and its plugins do is just commands to the builtin docker engine. That docker engine has everything you need to build dockers. It is documented extensively at the docker website.

 

https://www.docker.com/

 

Go to the command line and start playing around.

 

Link to comment
  • 2 years later...

Since this is the first thread that comes up on google and isn't very detailed, I just wanted to link the guide I just wrote.  It shows you how to create a docker container, add it to your own private docker registry (or you can use dockerhub), and then add it to the private apps section of Community Applications.

 

  • Like 5
  • Thanks 2
Link to comment
  • 11 months later...
On 7/6/2015 at 8:39 PM, sparklyballs said:

just do the build on your unraid box and you'll get a docker image appear in your docker tab, providing you've setup a docker.img file

this comment is pur gold.. thank you.. this works for me.. 

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.