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 && \
4949 echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
5050RUN chown -R fidimag $FIDIMAG_HOME
5151
52+ # For bind mounts from host
53+ RUN mkdir /io
54+ RUN chown -R fidimag /io
55+
5256USER fidimag
5357RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
5458
5559# Print something nice on entry.
5660# COPY WELCOME $FIDIMAG_HOME/WELCOME
5761
5862
59-
60- WORKDIR $FIDIMAG_HOME
63+ WORKDIR /io
6164CMD ["/bin/bash" ,"-i" ]
Original file line number Diff line number Diff line change 44
55# to run new image
66run : build
7- docker run -ti fidimag/minimal-py2
7+ docker run -v ` pwd ` :/io - ti fidimag/minimal-py2
88 # try 'ipython' and then 'import fidimag'
99
1010# 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:
2121 This command should show a bash prompt inside the docker container:
2222
2323 <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 $
2626 </pre >
2727
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-
5028## Creating the docker container
5129
5230The ` 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 && \
5050 echo "fidimag ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
5151RUN chown -R fidimag $FIDIMAG_HOME
5252
53+ # For bind mounts from host
54+ RUN mkdir /io
55+ RUN chown -R fidimag /io
56+
5357USER fidimag
5458RUN touch $FIDIMAG_HOME/.sudo_as_admin_successful
5559
Original file line number Diff line number Diff line change 44
55# to run new image
66run : build
7- docker run -ti fidimag/minimal-py3
7+ docker run -v ` pwd ` :/io - ti fidimag/minimal-py3
88 # try 'ipython3' and then 'import fidimag'
99
1010# 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:
2121 This command should show a bash prompt inside the docker container:
2222
2323 <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 $
2626 </pre >
2727
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-
5028## Creating the docker container
5129
5230The ` 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
2828RUN conda install --quiet --yes pytest
2929RUN py.test -v
3030
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
3136
32- WORKDIR $HOME/work
37+ WORKDIR /io
Original file line number Diff line number Diff line change 33 time docker build -t fidimag/notebook:latest .
44
55# 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
88
99# to push the new docker image to dockerhub (need to login first)
1010push : build
Original file line number Diff line number Diff line change @@ -16,15 +16,15 @@ To use it, you can try this:
1616
17173 . Start the container using
1818
19- docker run -d -p 30008:8888 fidimag/notebook
19+ docker run -v `pwd`:/io - d -p 30008:8888 fidimag/notebook
2020
2121 This will start a notebook server. You can see it in your browser at
2222http://localhost:30008/ on Linux, or http://192.168.99.100:30008/ on Mac (you may
2323need to change this IP address if your docker VM is at a different address).
2424
2525To run a shell instead of the notebook server, run:
2626
27- docker run -ti fidimag/notebook bash
27+ docker run -v `pwd`:/io - ti fidimag/notebook bash
2828
2929## Shortcomings
3030
You can’t perform that action at this time.
0 commit comments