Docker container developer best practice guidelines for unRAID


NAS

Recommended Posts

It looks like the current version of phusion/baseimage is 0.9.16.  According to the release notes, it disables ssh.  Is there a reason the recommended version is 0.9.15 instead?

 

According to the release notes:

0.9.16 (release date: 2015-01-20)

 

docker exec is now the default and recommended mechanism for running commands in the container. SSH is now disabled by default, but is still supported for those cases where "docker exec" is not appropriate. Closes GH-168.

All syslog output is now forwarded to docker logs. Closes GH-123.

The workaround for Docker bug 2267 (the inability to modify /etc/hosts) has been removed, because it has been fixed upstream. Closes GH-155.

Logrotate now reloads syslog-ng properly. Closes GH-167.

Fixed some locale issues. Closes GH-178. Thanks to David J. M. Karlsen.

Fixed problems with cron. Closes GH-115.

Contribution by Bryan Bishop.

 

may be as simple as a lack of maintenance on that thread, OP is on something of a sabbitical.

 

I do hope the OP comes back to the fold though, a good source of information and an invaluable help in many things, sorely missed.

Link to comment

Ahh, I looked at a couple of example dockfiles and they were pointing to 0.9.15, which is what is recommended on one of the follow-up pages of this thread.  Looks like you've already updated, so nevermind!  :)

 

there were some encouraging noises not so long ago about an unraid base image which i liked the look of.

 

although the runit system in phusion works for the vast majority of containers, i've found some instances where it is too sensitive and respawns apps that haven't crashed, i'm leaning more and more towards supervisor.

 

I've only seen that happen if the process it runs spawns itself into the background and returns to the caller; for instance the program you're running is loaded as a daemon itself.

Link to comment

Ahh, I looked at a couple of example dockfiles and they were pointing to 0.9.15, which is what is recommended on one of the follow-up pages of this thread.  Looks like you've already updated, so nevermind!  :)

 

there were some encouraging noises not so long ago about an unraid base image which i liked the look of.

 

although the runit system in phusion works for the vast majority of containers, i've found some instances where it is too sensitive and respawns apps that haven't crashed, i'm leaning more and more towards supervisor.

 

I've only seen that happen if the process it runs spawns itself into the background and returns to the caller; for instance the program you're running is loaded as a daemon itself.

 

the apps i've observed it with are admittedly rare but they are not daemonised per se or at least not obviously so. i'm not getting into specifics (mainly because i've drunk much cider this fine evening and my powers of specific recall are limited) but switcing to starting the app with supervisor as opposed to using runit resolved multiple instances of the app showing in top.

Link to comment
  • 1 year later...
  • 4 months later...

What do we need to do with our custom Docker images on unraid in order to get the "Edit Docker" option in the webui?

 

I can see that the dockers I have installed via Community Apps all have that, and you can set different options like port and cpupins ect. So how to add same feature to our own dockers? 

 

Thanks

Link to comment
  • 1 year later...
On 8/25/2017 at 9:04 AM, Squid said:

You have to add them via the add template and fill out the info. Adding via a manual command will not give the edit

Sent from my LG-D852 using Tapatalk
 

Where does the XML file go for a custom docker image if CA is pulling from the Docker hub? I'm having trouble finding information on how to setup these settings and pass them along to the Docker at runtime

Link to comment
1 minute ago, fordbaxter said:

Where does the XML file go for a custom docker image if CA is pulling from the Docker hub? I'm having trouble finding information on how to setup these settings and pass them along to the Docker at runtime

Docker hub apps are no different than containers listed in Community Applications. Both result in the Add Container page, and the entries in that form are stored as XML on the flash drive at /boot/config/plugins/dockerMan/templates-user/ as My-dockername.xml

Link to comment
8 hours ago, trurl said:

Docker hub apps are no different than containers listed in Community Applications. Both result in the Add Container page, and the entries in that form are stored as XML on the flash drive at /boot/config/plugins/dockerMan/templates-user/ as My-dockername.xml

Thank you for this information. I'm having trouble finding where Community Applications pulls this XML from. I'm new to unRAID and wanted to port tools I've made to community applications 

Link to comment
3 hours ago, Squid said:

It creates it itself by either downloading the dockerfile or scraping the docker page if it can't locate the dockerfile for as much relevant information as it can find

So Community Applications determines what args to pass when running the image (port, directories, logo) from the Dockerfile or Docker hub page? For example these types of app specific options: dXPBbfN.png

Link to comment

As best it can.  It's not like it can read the directions or anything.  If the container author included the various environment variables, paths, etc within the dockerfile, then it should properly fill out the template (minus any help text like what you posted above), and certain assumptions are made about network type, webUI port etc which is impossible to determine, and may or may not be correct.

 

But, there is zero requirement that the dockerfile contains that information within it, and no matter what you still have to read the docs on the dockerhub page for the container - Hence why its an option in CA that the user has to specifically enable and then have another click in order to display the results from dockerHub

Edited by Squid
  • Upvote 1
Link to comment
5 hours ago, fordbaxter said:

I'm new to unRAID and wanted to port tools I've made to community applications 

If you have a docker of your own on dockerhub, then just use the Add Container page in unRAID to specify all the docker run parameters such as volume mappings, etc. Then when you have the Add Container page filled out just like you want it add the container, it will create the XML file you are talking about and store it in the location I mentioned before:

14 hours ago, trurl said:

the entries in that form are stored as XML on the flash drive at /boot/config/plugins/dockerMan/templates-user/ as My-dockername.xml

 

You can use that XML as a starting point to develop the template for your docker that others can use.

 

Not sure what is involved in actually getting your app added to Community Applications, Squid is in charge of that.

  • Upvote 1
Link to comment
  • 1 year later...
On 3/24/2017 at 7:19 AM, saarg said:

I would use alpine, debian or Ubuntu depending on which software you try to run and then use the S6 overlay process monitoring and init of software. 

I am attempting to pull a linux application into unraid as a docker.  My Dockerfile seems to work at my linux commandline when launched as a daemon but when I pull it into unraid via the "add container" option it doesn't run.  Doesn't really do anything, nothing in the log.  I suspect I am missing the process monitoring and init mentioned above.  Be gentle, I am new to this process. Would anyone mind giving me a pointer as to what I am missing?

 

I have been tring to follow examples from linuxserver.io, binhex, and ich777.  Most are not issuing the CMD at the end of the Dockerfile to kick off a process.  I added one to mine which makes it work from my linux dev box command line but when deployed in unraid, no worky.

 

FROM ubuntu
MAINTAINER kiowadriver

# set environment variables
ARG DEBIAN_FRONTEND="noninteractive"
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

RUN echo exit 0 > /usr/sbin/policy-rc.d & \
        apt-get update && apt-get install -y \
        apt-utils \
        software-properties-common \
        apt-transport-https \
        ca-certificates \
        wget \
        gnupg \
        && apt-get clean \
        && rm -rf /var/lib/apt/lists/*
 
# additional files
##################

# install app
############# 
RUN wget -q -O- https://jeffpiazza.org/derbynet/debian/jeffpiazza_derbynet.gpg | apt-key add -
RUN echo "deb [arch=all] https://jeffpiazza.org/derbynet/debian stable main" | tee /etc/apt/sources.list.d/derbynet.list > /dev/null
RUN echo exit 0 > /usr/sbin/policy-rc.d && \
 apt-get update && apt-get install derbynet-server -y && \
 apt-get clean && \
 rm -rf /var/lib/apt/lists/* && \
 echo "daemon off;" >> /etc/nginx/nginx.conf
 
# docker settings
#################

# map /etc/config to host defined config path (used to store configuration from app)
VOLUME /config
RUN ln -s /etc/derbynet.conf /config/

# expose port for http and https
EXPOSE 80
EXPOSE 443

# on startup make sure derbynet-server is the latest version
CMD ["apt-get update && apt-get install derbynet-server -y"]

# start nginx service
CMD ["nginx"]

 

Link to comment

@Squid, Thanks for responding.

 

I believe I am doing the same thing at the command line that unraid would be attempting to do when I click start:

 

docker create --name='derbynet_server' --net='somenet' -e TZ="America/Chicago" -e HOST_OS="Unraid" -e 'TIMER_USERNAME'='Timer' -e 'TIMER_PASSWORD'='xxx' -e 'PUID'='99' -e 'PGID'='100' -p '8070:80/tcp' -p '8071:443/tcp' -v '/mnt/cache/appdata/derbynet_server/config':'/config':'rw' 'mitchellriley/derbynet_server'

 

It is running fine from the linux command line.  In unraid, it doesn't start at all, no errors. just a blank log.

Edited by kiowa2005
Link to comment
18 minutes ago, Squid said:

That's not the command that the template returns though.  Unless I misread it, you wanted to know why it works at the command prompt and not via the template screen.

 

I was using the command from the template.  I paraphrased a bit since I was usign it on a different machine. I shortened the path and edited the -net parameter but the same command none the less.

 

I deleted the docker and re-installed it.  Now it starts and stays running so I am not sure what changed but I will take it.

 

However, when I click the log next to it I don't see any output.  Do I need to do something special in the Dockerfile to ensure the syslog or some other output is feeding that log view?

 

Thanks

 

 

Link to comment

Still having issues:

 

This docker seems to need both an "nginx" and "php-fpm7.2" process running.  I attempted the following:

CMD service php7.0-fpm start && nginx -g "daemon off;"

However, it seemed to not understand how to start as a service and wanted an absolute path. This has lead me down the path of supervisord to launch both processes. 

https://stackoverflow.com/questions/37313780/how-can-i-start-php-fpm-in-a-docker-container-by-default/37313908

 

I would think that the combination of FPM and nginx has been done before.  Am I going down a rabbit's hole or is this the best approach?

 

 

Link to comment
  • Squid unpinned this topic

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.