You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And move it into /learn, since it's an ImageJ usage topic.
The docs are Fiji-specific right now, unfortunately, but the plan
is to generalize the Docker image(s) to be ImageJ2, not only Fiji.
Copy file name to clipboardExpand all lines: _pages/learn/docker.md
+73-58Lines changed: 73 additions & 58 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
---
2
-
mediawiki: Docker
3
2
title: Docker
4
-
categories: [Uncategorized]
5
3
---
6
4
7
5
[Docker](https://www.docker.com/whatisdocker/) provides a platform for distribution of application state. This facilitates the highest level of scientific [reproducibility](/develop/architecture#reproducible-builds) - as a Docker image can bundle operating system, Java version, update site and plugin state, and even sample data. These images can then be reused by remote users and scientists worldwide, with no dependency concerns (beyond Docker itself).
@@ -13,30 +11,36 @@ You will need to [install Docker](https://docs.docker.com/installation/#installa
13
11
# How to use the Fiji Docker images
14
12
15
13
The base Fiji images are provided on [Docker Hub](https://registry.hub.docker.com/u/fiji/fiji/). These images call the Fiji executable by default. For example:
16
-
17
-
` docker run -it --rm fiji/fiji`
14
+
```shell
15
+
docker run -it --rm fiji/fiji
16
+
```
18
17
19
18
will call the default Fiji image, attempting to open the ImageJ UI with Java 7.
20
19
21
20
Several [tags](https://registry.hub.docker.com/u/fiji/fiji/tags/manage/) are provided to run Fiji with different Java versions. For example, if you wanted to run with Oracle's Java 6, you would use:
22
-
23
-
` docker run -it --rm fiji/fiji:fiji-oracle-jdk6`
24
-
25
-
**Important** - without some extra setup, there is no display used by Docker. So if you just tried one of the above commands, you likely got an error:
26
-
27
-
` No GUI detected. Falling back to headless mode.`
28
-
21
+
```shell
22
+
docker run -it --rm fiji/fiji:fiji-oracle-jdk6
23
+
```
24
+
25
+
{% include notice icon='warning' content="
26
+
Without some extra setup, there is no display used by Docker. So if you just tried one of the above commands, you likely got an error:
27
+
```
28
+
No GUI detected. Falling back to headless mode.
29
+
```
29
30
The following sections cover [headless](#running-headless) and [graphical](#running-the-ui) uses.
31
+
" %}
30
32
31
33
# Running headless
32
34
33
35
Running ImageJ headlessly in Docker is not much different than normal headless operation - see the [headless guide](/learn/headless) for general information. To start a headless ImageJ invocation from Docker, use:
34
-
35
-
` docker run -it --rm fiji/fiji fiji-linux64 --headless`
36
+
```shell
37
+
docker run -it --rm fiji/fiji fiji-linux64 --headless
38
+
```
36
39
37
40
If you want to manually explore the Fiji Docker image, e.g. to install additional plugins or utility software, you can start the command prompt via:
38
-
39
-
` docker run -it --rm fiji/fiji bash`
41
+
```shell
42
+
docker run -it --rm fiji/fiji bash
43
+
```
40
44
41
45
Just be sure to [commit any changes](https://docs.docker.com/userguide/dockerimages/#updating-and-committing-an-image)!
42
46
@@ -52,30 +56,35 @@ We can adapt [this blog post](http://fabiorehm.com/blog/2014/09/11/running-gui-a
52
56
53
57
Use this Dockerfile as a starting point:
54
58
55
-
` # Modify this tag if a different java version is desired`
Then, from a terminal, use Homebrew to install [socat](http://www.cyberciti.biz/faq/linux-unix-tcp-port-forwarding/) and [XQuartz](http://xquartz.macosforge.org/landing/) via:
94
-
95
-
`brew install socat`
96
-
97
-
` brew cask install xquartz`
103
+
```shell
104
+
brew install socat
105
+
brew cask install xquartz
106
+
```
98
107
99
108
Now open a new terminal window and type
100
-
101
-
`echo $DISPLAY`
102
-
109
+
```shell
110
+
echo$DISPLAY
111
+
```
103
112
and ensure it is not empty (it should print something like `/private/tmp/com.apple.launchd.GYg5TvcMIf/org.macosforge.xquartz:0`).
104
113
105
114
Then run:
106
-
107
-
`ifconfig`
108
-
115
+
```shell
116
+
ifconfig
117
+
```
109
118
which will print output that should end with something like:
And take note of the ip address on the last line (`192.168.15.2` in this case).
116
126
117
127
Since you are using macOS it is assumed you are using [boot2docker](http://boot2docker.io/). Now, in the same terminal you started boot2docker, you should have set up the environment variables e.g. with
118
-
119
-
` $(boot2docker shellinit)`
128
+
```shell
129
+
$(boot2docker shellinit)
130
+
```
120
131
121
132
From this same terminal, open XQuartz with:
122
-
123
-
` open -a XQuartz`
133
+
```shell
134
+
open -a XQuartz
135
+
```
124
136
125
137
This will start up a new X11 session. You will want two X11 terminals open here (`Application > Terminal` to open a new X11 terminal).
to start listening for X11 forwarding. In the second terminal, you can now use Docker to launch a Fiji GUI. For example:
132
-
133
-
` docker run -e DISPLAY=192.168.15.2:0 fiji/fiji`
145
+
```shell
146
+
docker run -e DISPLAY=192.168.15.2:0 fiji/fiji
147
+
```
134
148
135
149
Where the IP address was what we found earlier with `ifconfig`.
136
150
@@ -147,8 +161,9 @@ Once you have Fiji up and running, you will probably want to open some images.
147
161
The best way to share data with Docker is to use volumes, as described in [this blog post](http://haven.nightlyart.com/fiji-is-now-available-on-docker-hub/).
148
162
149
163
For example, if your data is in `/Users/foo/data`, launching the Fiji image with:
150
-
151
-
` docker run -v /Users/foo/data:/fiji/data -e DISPLAY=192.168.15.2:0 fiji/fiji`
164
+
```shell
165
+
docker run -v /Users/foo/data:/fiji/data -e DISPLAY=192.168.15.2:0 fiji/fiji
166
+
```
152
167
153
168
will create a `data` subdirectory in the Fiji installation, which you can then open images from as normal.
0 commit comments