My findings with Docker


Recommended Posts

Well, some of my findings/scripts about Docker:

 

[glow=red,2,300]1) Array start/stop:[/glow]

 

Well, this is a no go for me, so I managed to tweak some original scripts to accomplish this.

 

First I modified the docker web page to add an extra field, letting the user specify which containers should be managed using array events.

 

Then, I heavily modify the rc.docker script, allowing it to manage the containers by name and to retrieve the information inserted above. So now we can start and stop containers alongside the array.

 

The final work can be found in this PLG file. Tom and others can freely use it, and incorporate some of it's code into the official code, if they found it interesting.

 

https://dl.dropboxusercontent.com/u/18726846/Docker-startup.plg

 

 

[glow=red,2,300]2) Docker cleanup[/glow]

 

So you got tired from docker and want do remove it completely. This are some codes to help you accomplish that.

 

Remove all containers:

 

#!/bin/bash
# Stop running containers
RUNNING=$(docker ps -q 2>/dev/null)
if [[ -n ${RUNNING} ]]; then
  docker stop ${RUNNING}
fi

# Remove all containers
ALL=$(docker ps -a -q 2>/dev/null)
if [[ -n ${ALL} ]]; then
  docker rm ${ALL}
fi

 

 

Remove all images:

 

To remove all images, there is one more step:

 

#!/bin/bash
# Stop running containers
RUNNING=$(docker ps -q 2>/dev/null)
if [[ -n ${RUNNING} ]]; then
  docker stop ${RUNNING}
fi

# Remove all containers
ALL=$(docker ps -a -q 2>/dev/null)
if [[ -n ${ALL} ]]; then
  docker rm ${ALL}
fi

# Remove all images
IMAGES=$(docker images -q 2>/dev/null)
if [[ -n ${IMAGES} ]]; then
  docker rmi ${IMAGES}
fi

 

 

Wipe docker home:

 

To wipe correctly the docker home, you MUST use something like this. It will remove all data, including some orphaned BTRFS sub volumes.

 

#!/bin/bash

/etc/rc.d/rc.docker stop

if [[ -f /etc/default/docker ]]; then
  . /etc/default/docker
  if [[ -d ${DOCKER_HOME} ]]; then
    if [[ -d ${DOCKER_HOME}/btrfs/subvolumes ]]; then
      find ${DOCKER_HOME}/btrfs/subvolumes -type d -mindepth 1 -maxdepth 1 -exec btrfs subvolume delete '{}' \;
    fi
    rm -rf ${DOCKER_HOME}
  fi
fi

 

Hope you all enjoy.

Link to comment

Thanks, works good.  I would change the name of the thread to Docker Startup or auto start.  Also, it took me a minute looking at the code to figure out that you had to stop docker to see the extra line to add containers. Could have used the scripts yesterday but removed all manually. Thanks

 

Link to comment

I concur nice work.

 

Can I suggest the scripts are given a home at somewhere like github and/or a license of your choosing added for clarification. This way the code can be used legally by users and developers and it makes it available for all time.

 

We have a load of forum posted code snippets that are now technically dead because of this so best to start as we mean to continue.

 

:)

 

 

Link to comment

GFJARDIM ... YOU THE MAN  :o

 

clean docker script worked a charm :)

 

I see you made a crashplan docker ...

how do we access it ?

i assume with this supervisor?

but how does it work ?

what is even the startup line for this crashplan?

 

Docker -d -h="hostname" --name="crashplan" -V ? -p 4242:4242 -p 4243:4243 gfjardim/crashplan ??

 

and then 2 more questions....

you guys are running this from the pure unraid setup ? no Xen?

 

and any serious mysql / php/Apache docker that you know off ?

to run my personal newznab server which is running in a xen for now....

 

 

 

Link to comment

you guys are running this from the pure unraid setup ? no Xen?

 

and any serious mysql / php/Apache docker that you know off ?

to run my personal newznab server which is running in a xen for now....

I still run a mythtv backend in xen which needs Apache for mythweb & mysql which I also use for xbmc. On the docker hub tutum/lamp may work for you.

https://registry.hub.docker.com/u/tutum/lamp/

Link to comment

GFJARDIM ... YOU THE MAN  :o

 

clean docker script worked a charm :)

 

I see you made a crashplan docker ...

how do we access it ?

i assume with this supervisor?

but how does it work ?

what is even the startup line for this crashplan?

 

Docker -d -h="hostname" --name="crashplan" -V ? -p 4242:4242 -p 4243:4243 gfjardim/crashplan ??

 

and then 2 more questions....

you guys are running this from the pure unraid setup ? no Xen?

 

and any serious mysql / php/Apache docker that you know off ?

to run my personal newznab server which is running in a xen for now....

 

Thanks! ;D

 

1) Crashplan:

 

Just pushed the image to Docker Hub: https://registry.hub.docker.com/u/gfjardim/crashplan/

 

You have to modify the "ui.properties" file from your client to something like this (my unRAID server ip is 192.168.0.100):

 

#Fri Dec 09 09:50:22 CST 2005
serviceHost=192.168.0.100
servicePort=4243
#pollerPeriod=1000  # 1 second
#connectRetryDelay=10000  # 10 seconds
#connectRetryAttempts=3
#showWelcome=true

#font.small=
#font.default=
#font.title=
#font.message.header=
#font.message.body=
#font.tab=

 

2) I'm testing it under Xen until everything works.

Link to comment

I tried running this with:

 

docker run -d -h ${HOSTNAME} --name=crashplan -v /mnt/cache/appdata/crashplan:/data -v /etc/localtime:/etc/localtime:ro -p 4242:4242 -p 4243:4243 gfjardim/crashplan

 

It will not run the program. Nothing shows running with "docker ps", and there are no log files to check, because it's not installing anything. How do I get the docker to load?

Link to comment

I tried running this with:

 

docker run -d -h ${HOSTNAME} --name=crashplan -v /mnt/cache/appdata/crashplan:/data -v /etc/localtime:/etc/localtime:ro -p 4242:4242 -p 4243:4243 gfjardim/crashplan

 

It will not run the program. Nothing shows running with "docker ps", and there are no log files to check, because it's not installing anything. How do I get the docker to load?

 

docker ps -a will show all the containers ever run

docker logs containername will show logs

 

you should use the option --net=host

Link to comment

yeah i also had to use --net=host as otherwise the 2 unraid servers where not finding each other....

which was kind of funny... my windows machines found the one unraid server and where backing up to it...

but the 2 unraids said offline to each other....

 

once i changed to --net=host the issue went away

Link to comment

yeah i also had to use --net=host as otherwise the 2 unraid servers where not finding each other....

which was kind of funny... my windows machines found the one unraid server and where backing up to it...

but the 2 unraids said offline to each other....

 

once i changed to --net=host the issue went away

 

Thank you for sharing that!

Link to comment

Neither command will do anything. How do I verify Crashplan is running? Usually, when I try to connect with the client, it tells me "Connection refused" when the daemon isn't running, which is what it's doing now. "docker ps -a" indicates that the docker has exited, which means it's not running, right?

Link to comment

Neither command will do anything. How do I verify Crashplan is running? Usually, when I try to connect with the client, it tells me "Connection refused" when the daemon isn't running, which is what it's doing now. "docker ps -a" indicates that the docker has exited, which means it's not running, right?

 

Try telnet SERVERIP 4243 to see if it's running.

 

Please, run the container  then grab it's log with "docker logs crashplan" and post it here.

Link to comment

yeah i also had to use --net=host as otherwise the 2 unraid servers where not finding each other....

which was kind of funny... my windows machines found the one unraid server and where backing up to it...

but the 2 unraids said offline to each other....

 

once i changed to --net=host the issue went away

 

How do you get this to work?  I've changed my docker command to use --net="host" and I still can't access my other unraid server, or maybe I just don't know how to...

 

I think there must be some other setup I'm missing.

 

Doug

Link to comment

basically i still use the portforwarded putty ssh sessions like before together with this https://github.com/Hossy/win-crashplan-uiswitcher

 

just install it ... change the settings as per readme... and create 3 desktop icons with links ....

 

double click the desktop icon and it will open a cmd window ... launch putty ... you have to manually input login and password... once that is done go back to the cmd window and click any key ....

crashplan gui will open to your server..

 

Link to comment

Sorry I should have been more clear.  I'm not using CrashPlan.  I'm just trying to get my 2 UnRAID servers to see each other.

 

Thanks,

 

Doug

Changing /etc/fstab does not work because (as you have found) this is in RAM and thus not persistent between boots.  The way to do this would be to add appropriate mount commands in your 'go' file so they get repeated each time you boot the system.

Link to comment

basically i still use the portforwarded putty ssh sessions like before together with this https://github.com/Hossy/win-crashplan-uiswitcher

 

just install it ... change the settings as per readme... and create 3 desktop icons with links ....

 

double click the desktop icon and it will open a cmd window ... launch putty ... you have to manually input login and password... once that is done go back to the cmd window and click any key ....

crashplan gui will open to your server..

 

The docker modify the Crashplan configuration upon the installation to allow remote access to the UI, so you do not need to create a ssh tunnel for it. I've just duplicated the Crashplan App (I'm on OSX) with different settings for each. In windows I used to duplicate the program dir

Link to comment

Sorry I should have been more clear.  I'm not using CrashPlan.  I'm just trying to get my 2 UnRAID servers to see each other.

 

Thanks,

 

Doug

Changing /etc/fstab does not work because (as you have found) this is in RAM and thus not persistent between boots.  The way to do this would be to add appropriate mount commands in your 'go' file so they get repeated each time you boot the system.

 

I've been searching through the forums all morning and had found the information about adding this to the GO script.  Now I just need to figure out those appropriate mount commands.

 

So if I have these shares I want to connect to from TowerB:

 

//tower/TV

//tower/MOVIES

 

Mounting them to:

 

/mnt/user/tv

/mnt/user/movies

 

What's the best way to create the mount command?

 

They are public shares with no user/pass

 

Thanks for the help!

 

Doug

Link to comment

Sorry I should have been more clear.  I'm not using CrashPlan.  I'm just trying to get my 2 UnRAID servers to see each other.

 

Thanks,

 

Doug

Changing /etc/fstab does not work because (as you have found) this is in RAM and thus not persistent between boots.  The way to do this would be to add appropriate mount commands in your 'go' file so they get repeated each time you boot the system.

 

I've been searching through the forums all morning and had found the information about adding this to the GO script.  Now I just need to figure out those appropriate mount commands.

 

So if I have these shares I want to connect to from TowerB:

 

//tower/TV

//tower/MOVIES

 

Mounting them to:

 

/mnt/user/tv

/mnt/user/movies

 

What's the best way to create the mount command?

 

They are public shares with no user/pass

 

Thanks for the help!

 

Doug

 

Okay so I've been playing around with this and so far I've tried:

 

mount -t nfs 192.168.1.12:/tv /mnt/user/tv  -->  I get back 'permission denied'

mount.cifs //192.168.1.12/tv/ /mnt/user/tv  -->  I get back a Password prompt:

 

I don't have any users/passwords on my shares on the other server so I'm not sure what gives.

Link to comment

mount.cifs //192.168.1.12/tv/ /mnt/user/tv  -->  I get back a Password prompt:

 

I don't have any users/passwords on my shares on the other server so I'm not sure what gives.

This is the right basic format for mounting a network share.    However I think you will have to give a -o parameter as well to provide some mount time options.  You are likely to want to specify the username/group the share is to be mounted as at the very least I would have thought to get permissions correct.  I think if you provide a username on the remote system this might also stop you being prompted for a password but I am not sure.

Link to comment

mount.cifs //192.168.1.12/tv/ /mnt/user/tv  -->  I get back a Password prompt:

 

I don't have any users/passwords on my shares on the other server so I'm not sure what gives.

This is the right basic format for mounting a network share.    However I think you will have to give a -o parameter as well to provide some mount time options.  You are likely to want to specify the username/group the share is to be mounted as at the very least I would have thought to get permissions correct.  I think if you provide a username on the remote system this might also stop you being prompted for a password but I am not sure.

 

Adding -o guest to the end worked.  Now I can access my shares.  I'll have to do more testing to see if I have the needed permissions.

 

Thanks!

 

Doug

Link to comment

I went with this:

 

Quote

docker run -d --name="crashplan" -v /mnt/cache/appdata/crashplan:/data -v /mnt/user:/mnt/user -v /mnt/cache:/mnt/cache -v /etc/localtime:/etc/localtime:ro -p 4242:4242 -p 4243:4243 gfjardim/crashplan

 

I think dropping the -h ${HOSTNAME} did the trick. I had to make sure the appropriate directories were mounted so it had access to backup, but it's working great.

 

Is the .identity file preserved within the container so I won't need to keep logging in and adopting the backup every time? I set the config directory to as above. Should there be anything stored in this directory? The docker is running, but the config directory is empty. It is also created as root:root. I left that alone, but all my other config directories are nobody:users. Should I leave it like that or does it need to be chown'ed to nobody:users?

 

Thanks.

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.