File tree Expand file tree Collapse file tree 9 files changed +25
-57
lines changed Expand file tree Collapse file tree 9 files changed +25
-57
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,16 @@ RUN useradd -m -s /bin/bash -G sudo fidimag && \
49
49
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
50
50
RUN chown -R fidimag $FIDIMAG_HOME
51
51
52
+ # For bind mounts from host
53
+ RUN mkdir /io
54
+ RUN chown -R fidimag /io
55
+
52
56
USER fidimag
53
57
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
54
58
55
59
# Print something nice on entry.
56
60
# COPY WELCOME $FIDIMAG_HOME/WELCOME
57
61
58
62
59
-
60
- WORKDIR $FIDIMAG_HOME
63
+ WORKDIR /io
61
64
CMD ["/bin/bash" ,"-i" ]
Original file line number Diff line number Diff line change 4
4
5
5
# to run new image
6
6
run : build
7
- docker run -ti fidimag/minimal-py2
7
+ docker run -v ` pwd ` :/io - ti fidimag/minimal-py2
8
8
# try 'ipython' and then 'import fidimag'
9
9
10
10
# to push the new docker image to dockerhub (need to login first)
Original file line number Diff line number Diff line change @@ -21,32 +21,10 @@ To use it, you can try this:
21
21
This command should show a bash prompt inside the docker container:
22
22
23
23
<pre >
24
- bin:docker fangohr$ docker run -ti fidimag/minimal-py2
25
- fidimag@38fdd2a0feb4:~ $
24
+ bin:docker fangohr$ docker run -v `pwd`:/io - ti fidimag/minimal-py2
25
+ fidimag@38fdd2a0feb4:/io $
26
26
</pre >
27
27
28
- One way to test the installation is to run the unit tests:
29
-
30
- <pre >
31
- fidimag@38fdd2a0feb4:~$ cd fidimag/tests/
32
- fidimag@38fdd2a0feb4:~/fidimag/tests$ py.test -v
33
- ========== test session starts =======================
34
- platform linux2 -- Python 2.7.6 -- pytest-2.5.1 -- /usr/bin/python
35
- collected 63 items
36
-
37
- field_test.py:7: test_initialise_scalar PASSED
38
- field_test.py:13: test_initialise_vector PASSED
39
- test_2dpbc_cube.py:10: test_compute_field PASSED
40
- test_anis.py:7: test_anis PASSED
41
- .
42
- .
43
- .
44
- </pre >
45
-
46
- ## Shortcomings
47
-
48
- - need to share directory between host and container (MOUNT or VOLUME)
49
-
50
28
## Creating the docker container
51
29
52
30
The ` Makefile ` in this directory shows the relevant targets (build, login, push)
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ RUN useradd -m -s /bin/bash -G sudo fidimag && \
50
50
echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
51
51
RUN chown -R fidimag $FIDIMAG_HOME
52
52
53
+ # For bind mounts from host
54
+ RUN mkdir /io
55
+ RUN chown -R fidimag /io
56
+
53
57
USER fidimag
54
58
RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
55
59
Original file line number Diff line number Diff line change 4
4
5
5
# to run new image
6
6
run : build
7
- docker run -ti fidimag/minimal-py3
7
+ docker run -v ` pwd ` :/io - ti fidimag/minimal-py3
8
8
# try 'ipython3' and then 'import fidimag'
9
9
10
10
# to push the new docker image to dockerhub (need to login first)
Original file line number Diff line number Diff line change @@ -21,32 +21,10 @@ To use it, you can try this:
21
21
This command should show a bash prompt inside the docker container:
22
22
23
23
<pre >
24
- bin:docker fangohr$ docker run -ti fidimag/minimal-py3
25
- fidimag@38fdd2a0feb4:~ $
24
+ bin:docker fangohr$ docker run -v `pwd`:/io - ti fidimag/minimal-py3
25
+ fidimag@38fdd2a0feb4:/io $
26
26
</pre >
27
27
28
- One way to test the installation is to run the unit tests:
29
-
30
- <pre >
31
- fidimag@38fdd2a0feb4:~$ cd fidimag/tests/
32
- fidimag@38fdd2a0feb4:~/fidimag/tests$ py.test-3 -v
33
- ========== test session starts =======================
34
- platform linux2 -- Python 3.4.3 -- pytest-2.5.1 -- /usr/bin/python3
35
- collected 63 items
36
-
37
- field_test.py:7: test_initialise_scalar PASSED
38
- field_test.py:13: test_initialise_vector PASSED
39
- test_2dpbc_cube.py:10: test_compute_field PASSED
40
- test_anis.py:7: test_anis PASSED
41
- .
42
- .
43
- .
44
- </pre >
45
-
46
- ## Shortcomings
47
-
48
- - need to share directory between host and container (MOUNT or VOLUME)
49
-
50
28
## Creating the docker container
51
29
52
30
The ` Makefile ` in this directory shows the relevant targets (build, login, push)
Original file line number Diff line number Diff line change @@ -28,5 +28,10 @@ RUN conda install --quiet --yes icu
28
28
RUN conda install --quiet --yes pytest
29
29
RUN py.test -v
30
30
31
+ # /io will be mounted from the host system
32
+ USER root
33
+ RUN mkdir /io
34
+ RUN chown -R $NB_USER /io
35
+ USER $NB_USER
31
36
32
- WORKDIR $HOME/work
37
+ WORKDIR /io
Original file line number Diff line number Diff line change 3
3
time docker build -t fidimag/notebook:latest .
4
4
5
5
# to run new image
6
- run :
7
- docker run -ti fidimag/notebook bash
6
+ run : build
7
+ docker run -v ` pwd ` :/io -d -p 30008:8888 fidimag/notebook
8
8
9
9
# to push the new docker image to dockerhub (need to login first)
10
10
push : build
Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ To use it, you can try this:
16
16
17
17
3 . Start the container using
18
18
19
- docker run -d -p 30008:8888 fidimag/notebook
19
+ docker run -v `pwd`:/io - d -p 30008:8888 fidimag/notebook
20
20
21
21
This will start a notebook server. You can see it in your browser at
22
22
http://localhost:30008/ on Linux, or http://192.168.99.100:30008/ on Mac (you may
23
23
need to change this IP address if your docker VM is at a different address).
24
24
25
25
To run a shell instead of the notebook server, run:
26
26
27
- docker run -ti fidimag/notebook bash
27
+ docker run -v `pwd`:/io - ti fidimag/notebook bash
28
28
29
29
## Shortcomings
30
30
You can’t perform that action at this time.
0 commit comments