xnat-docker-compose + container service plugin

252 views
Skip to first unread message

jor...@radiologics.com

unread,
May 30, 2018, 12:35:34 PM5/30/18
to xnat_discussion
Does anyone know what magic is necessary to get the container service plugin to run inside a dockerized xnat-web?

I can't seem to install docker inside a docker container so setting the plugin's docker host to something like "unix:///var/run/docker.sock" won't work.

Is there a way to reach my host machine's docker server from inside the xnat-web container? My host is os x, running 18.03.1-ce-mac65

thanks!
jordan

John Flavin

unread,
May 30, 2018, 12:47:08 PM5/30/18
to XNAT Discussion board
Mount the host's socket into the container. Create a mount from /var/run/docker.sock (host) to /var/run/docker.sock (container).

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

Jordan Woerndle

unread,
May 30, 2018, 1:27:33 PM5/30/18
to xnat_di...@googlegroups.com
That totally worked!

For anyone that's interested, it is as simple as adding the line:

- /var/run/docker.sock:/var/run/docker.sock

to the volumes section of xnat-web in docker-compose.yml 

Thanks John!


On Wed, May 30, 2018 at 11:47 AM, John Flavin <fla...@gmail.com> wrote:
Mount the host's socket into the container. Create a mount from /var/run/docker.sock (host) to /var/run/docker.sock (container).
On May 30, 2018, at 11:35 AM, jor...@radiologics.com wrote:

Does anyone know what magic is necessary to get the container service plugin to run inside a dockerized xnat-web?

I can't seem to install docker inside a docker container so setting the plugin's docker host to something like "unix:///var/run/docker.sock" won't work.

Is there a way to reach my host machine's docker server from inside the xnat-web container? My host is os x, running 18.03.1-ce-mac65

thanks!
jordan

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/EKolHun0RUE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.

Tom Close

unread,
May 31, 2018, 1:11:01 AM5/31/18
to xnat_discussion
Is there any reason that we didn't make this the default?


On Thursday, 31 May 2018 03:27:33 UTC+10, Jordan Woerndle wrote:
That totally worked!

For anyone that's interested, it is as simple as adding the line:

- /var/run/docker.sock:/var/run/docker.sock

to the volumes section of xnat-web in docker-compose.yml 

Thanks John!

On Wed, May 30, 2018 at 11:47 AM, John Flavin <fla...@gmail.com> wrote:
Mount the host's socket into the container. Create a mount from /var/run/docker.sock (host) to /var/run/docker.sock (container).
On May 30, 2018, at 11:35 AM, jor...@radiologics.com wrote:

Does anyone know what magic is necessary to get the container service plugin to run inside a dockerized xnat-web?

I can't seem to install docker inside a docker container so setting the plugin's docker host to something like "unix:///var/run/docker.sock" won't work.

Is there a way to reach my host machine's docker server from inside the xnat-web container? My host is os x, running 18.03.1-ce-mac65

thanks!
jordan

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "xnat_discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xnat_discussion/EKolHun0RUE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.

Jordan Woerndle

unread,
May 31, 2018, 10:11:14 AM5/31/18
to xnat_di...@googlegroups.com
I'm not sure how that default would work on a windows host. Anyone running docker on windows around here?

I might have hit another snag. The debug container doesn't work. I get a ContainerException that says, 'Nothing to upload for output "output".'  For some reason the containers can't write to whatever directory is mapped to /output.

I have been trying to debug it, but nothing so far. My next plan is to try to execute the debug container manually, but I'm still trying to map the container-service json stuff to the command line docker command. got everything but the mounts so far.

jordan

To unsubscribe from this group and all its topics, send an email to xnat_discussion+unsubscribe@googlegroups.com.
To post to this group, send email to xnat_discussion@googlegroups.com.

John Flavin

unread,
May 31, 2018, 11:01:26 AM5/31/18
to XNAT Discussion board
This is a complication I hadn't considered. One of the prerequisites for the container service to work properly is that the archive and build spaces have to be mounted on all machines where the containers will run. 

Since in this case the containers are running on your host's docker, when you create mounts the mounted directories will also need to exist on your host machine. You may be doing that with your archive already, so it can survive xnat restarts, but you are likely not doing that for your build space.

So make a directory somewhere for your build space and add a volume for it in your docker-compose.yaml. It should go to /data/xnat/build. And if you aren't yet mounting your archive, you'll need to do that as well.

Flavin

Jordan Woerndle

unread,
May 31, 2018, 3:24:33 PM5/31/18
to xnat_di...@googlegroups.com
John, thank you. that totally worked. Here's what I did to get debug container to work:

on my osx host machine (I'll call it laptop from here on out) mkdir until you have /data/xnat/home

I was already using my containers so there was data already in things like xnat-local/filesystem. I copied that data to /data/xnat, specifically
logs -> /data/xnat/home/logs
plugins -> /data/xnat/home/plugins (now when you want to use a plugin, you have to copy it to /data/xnat/home/plugins instead of xnat-local/plugins)
filesystem/archive -> /data/xnat/archive
filesystem/build -> /data/xnat/build
filesystem/prearchive -> /data/xnat/prearchive
filesystem/cache -> /data/xnat/cache

You'll probably want to rm xnat-local/filesystem, xnat-local/logs and xnat-local/plugins so you don't confuse yourself later.

I'm on a mac, so I had to go to docker preferences (whale at the top of the screen->preferences) and add /data/xnat to the filesharing tab. It didn't work the first time, so I did a docker-compose down and docker-compose rm then restarted docker... then it let me add /data/xnat (that also required a docker restart) Now my containers have access to /data/xnat on my laptop. yay.

Next, edit xnat-local/docker-compose.yml by changing the xnat-web volumes section to look like this:

       volumes:
        - ./webapps:/opt/tomcat/webapps
        - /data/xnat/home/logs:/data/xnat/home/logs
        - /data/xnat/home/plugins:/data/xnat/home/plugins
        - /data/xnat/archive:/data/xnat/archive
        - /data/xnat/prearchive:/data/xnat/prearchive
        - /data/xnat/cache:/data/xnat/cache
        - /data/xnat/build:/data/xnat/build
        - /var/run/docker.sock:/var/run/docker.sock

Note, you can't just share /data/xnat:/data/xnat because if you do, /data/xnat/home/config doesn't appear and xnat won't start (ask me about the 3 hours I spent figuring that one out) 

Finally, docker-compose up -d  and you should be good to go.

Jordan

Flavin

To unsubscribe from this group and all its topics, send an email to xnat_discussion+unsub...@googlegroups.com.

To post to this group, send email to xnat_discussion@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussion+unsub...@googlegroups.com.

To post to this group, send email to xnat_discussion@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages