Nathan,

On 2019-07-29, Nathan Dunfield <[email protected]> wrote:
> You can start a container and open a shell on it via:
>
> docker run -it image_name /bin/bash
>
> The container will keep running until you exit the shell, if not longer.  
> You can open a shell on any running container via
>
> docker exec -it container_name /bin/bash

It works to some extent: When I do
  docker run -it --name bla sagemath/sagemath-dev:latest /bin/bash
then (after waiting for some time because apparently the docker image
does some compilation of Sage before doing anything else) I am indeed in
a bash in docker - and stay there, interactively, which is not what I
want.

I.e., I need to leave with ctrl-p and ctrl-q, and then I can execute
commands in that container (such as
   docker container exec bla sage -i meataxe
)

How can I start/run the container so that I don't need ctrl-p and
ctrl-q? After all, I want to use the container with a script, not
interactively. I tried the option "-dit", but then I don't know (and the
script doesn't know) how long I need to wait until the preparatory steps
of the container are done. Right after 
  docker run -dit --name bla sagemath/sagemath-dev:latest /bin/bash
the command
  docker container exec bla sage -c "print('Hello')"
fails, because "sage.all" is not there yet:
Traceback (most recent call last):
  File "/home/sage/sage/src/bin/sage-eval", line 4, in <module>
      from sage.all import *
ImportError: No module named sage.all

The same command works after waiting long enough.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/qhovbd%246m21%241%40blaine.gmane.org.

Reply via email to