Thank you for testing it. This line should work for your case:
​
​
    sudo docker run -t -i -v /home/USER1/FEniCS:/opt/data
lzlarryli/fenics:test​ /bin/bash
​The command docker wants to see is /bin/bash, so you get the terminal.

Also you should check if you have the folder /opt/data in the virtual
machine​ (it is not in that image). Maybe I should explain this a bit.
Docker is partially modelled on git, but for live operating systems.
"docker pull xxx" does the same thing as "git clone", you get a copy of the
system. Then each time you do a "docker run --name a ...", you fork and get
a branch named a. Since you mentioned FEniCS is running, I guess you ran
the line first:
    sudo docker run -t -i --name fenics -v /tmp:/tmp lzlarryli/fenics:test
/bin/bash​
​and created the folder /opt/data there and then exit. When you exit, the
branch named fenics is freezed. Now, you run ​
​    sudo docker run -t -i -v /home/USER1/FEniCS:/opt/data
lzlarryli/fenics:test​ /bin/bash​
​Since the name is not specified, it will get a random name, which you can
see by running "docker ps -a". But this branch starts from the initial
image again, not the "fenics" branch, which means this new virtual machine
does not have /opt/data in it. ​

So you might want to delete the "fenics" branch first created:
   sudo docker rm fenics
If you are like me, you probably did "docker run ..." many times to test
things out, which created a bunch of hanging braches of no use. You can
delete them all by:
​   sudo docker rm $(sudo docker ps -a -q)​
Then start a new branch named "fenics" again with your folder mounted on
/opt (which is always there..):
​
​
   sudo docker run -t -i -v /home/USER1/FEniCS:/opt lzlarryli/fenics:test​
/bin/bash
​After you exit, if you want to use this branch again, you don't use
"docker run.." but instead use:
   sudo docker start fenics
   sudo docker attach fenics
   [ctrl+c]
In this way you can continue your work.​


On Fri, Jun 13, 2014 at 11:43 AM, Serge-Étienne Parent <[email protected]>
wrote:

> Thanks Larry. FEniCS is running fine in Docker. That's a Docker question,
> but how do I run a local script? I tried to mount a local directory, but...
>
> $
> ​​
> sudo docker run -v /home/USER1/FEniCS:/opt/data lzlarryli/fenics:test
> 2014/06/13 12:38:01 Error: No command specified
>
> Cheers,
>
> Essi
>
>
> Le jeu 12 jun 2014 à 1:39, Lizao Li <[email protected]> a écrit :
>
> I made a dockerized version of FEniCS (to be defined below). I would like
> to hear some comments and see if there is interest in adding this as yet
> another way of deploying FEniCS.
>
> Docker (http://www.docker.com/) is an open source lightweight virtual
> machine, popular among the cloud computing community. It has many advanced
> features but the only thing that matters here is that it is easy, fast, and
> runs almost everywhere (win, mac, linux, google cloud, amazon ec2, etc, but
> no, not yet android~).
>
> The result is a "FEniCS-in-a-box" with the following objectives achieved:
> - Get FEniCS running with <5 lines of command on most computers (I get
> FEniCS with 3 lines on ArchLinux).
> - Preferrably not compiling for hours. If it has to be compiled, it is
> guaranteed to succeed (even on a cluster with weird toolchains).
> - FEniCS is properly contained in a stable environment (unaffected by
> things like boost, gcc updates) and can be shared between computers (for
> checking and comparison).
> - Minimal loss of performance.
>
> To test it:
> 1. Go to http://docs.docker.com, find out how to install docker on your
> system (1 line command in ArchLinux, similar for most linux distros).
> 2. Deploy the FEniCS 1.4 image (1 line, download ~4GB, pretty fast, no
> compiling)
>     sudo docker pull lzlarryli/fenics:test
> 2'. Alternatively, you can build FEniCS against a minimum Ubuntu (2 lines,
> ~1Gb download, ~30 min compiling):
>     wget http://www.math.umn.edu/~lixx1445/fenics_docker/Dockerfile
>     sudo docker build -t="lzlarryli/fenics:test" .
> 3. Run FEniCS (1 line):
>     sudo docker run -t -i --name fenics -v /tmp:/tmp lzlarryli/fenics:test
> /bin/bash
> The above creates a virtual machine instance based on the FEniCS image:
>              -t  means attach a terminal
>              -i  means interactive
>              --name  gives a name to the machine
>              -v /tmp:/tmp   mounts the local /tmp to the /tmp in the
> virtual machine so files can be shared.
> After running that line, you end up in the FEniCS demo directory and can
> go ahead and run some demos (fenics.conf is souced already).
> 4. Once done, run exit. It is the same as ssh into another computer.
>
> To use FEniCS again, just run
>     sudo docker start fenics
>     sudo docker attach fenics
>     [ctrl+c]
>
> Clean up
>     Remove this virtual machine instance:
>        sudo docker rm fenics
>     Remove the downloaded image:
>        sudo docker rmi lzlarryli/fenics:test
>     Uninstall docker.
>
> How is this build?
> It is built from a simple Dockerfile (
> http://www.math.umn.edu/~lixx1445/fenics_docker/Dockerfile), which
> basically downloads a minimal Ubuntu (~80Mb) and then use Dorsal to compile
> a FEniCS in it. In fact with the same file, DockerHub (also free) can link
> repositories to Bitbucket, which completely automates the process of
> building images. DockerHub is free for binary repositoreis of arbitrary
> size, as long as it is public. This is one of Docker's advantage over other
> virtual machines, where images have to be produced by hand and hosted
> somewhere.
>
> Sudo?
> It is annoying that sudo is used all the time. This undesirable effect can
> be dealt with by installing sshd in the virtual machine and expose the port
> to the local machine (2 lines, see Docker docs). Then administrators (who
> not necessarily know how to compile FEniCS) can use sudo to install docker,
> FEniCS, and run the virtual machine as a daemon. Users can then ssh into it
> without sudo or anything else. The users are contained in the virtual
> machine, so it is safe.
>
> Performance?
> This is the part I was not able to test in a reasonable way. I have FEniCS
> 1.3 on various systems (none of them runs ubuntu) and FEniCS 1.4 on the
> virtual Ubuntu machine. The dockerized version runs enlarged FEniCS demo
> problems faster than the native on the same computer, which is ridiculous.
> I can only say that probably 1.4 is faster than 1.3 (good job, btw). Most
> modern (reads non-graduate-student-office) computers have virtualization,
> which makes the virtual machine performance comparable to the native one.
> You are welcome to test and show benchmark results.
>
> ​Trade-offs?
> Precompiled binaries or binaries compiled against standard libraries
> certainly performs worse than those compiled against hardware-specific
> optimized libraries. Yet there are quite many cases where performance is
> not critical but easy deployment is: (1) students, (2) new users, (3) code
> developement and testing, (4) cluster/system admins who are not familar
> with numerical software, (5) theoretical numerical analysts (use cluster
> only when memory outflows), (6) people who have to run FEniCS on many
> different platforms. Personally, I am (5)(6) and sometimes (4) breaks
> FEniCS on machines I want to use. This at least makes my life quite easier.
>
>
> More info about docker (can be interesting):
> http://www.docker.com/tryit/
> https://docs.docker.com/userguide/
>
>
> --
> Lizao (Larry) Li
> Univeristy of Minnesota
>
>


-- 
Lizao (Larry) Li
Univeristy of Minnesota
_______________________________________________
fenics mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics

Reply via email to