how to list/stop running singularity containers? like in docker "docker ps"

1,969 views
Skip to first unread message

Bangarusamy K

unread,
Nov 9, 2017, 2:48:47 AM11/9/17
to singularity
Hi Team,

How to list running container in singularity and how to stop it.? like in docker we have "docker ps" command. Anything like in singularity?

v

unread,
Nov 9, 2017, 3:46:11 AM11/9/17
to singu...@lbl.gov
I thank you want the "instance" group of commands:


singularity instance.list
singularity instance.stop
singularity instance.start

On Wed, Nov 8, 2017 at 11:48 PM, Bangarusamy K <bangar...@gmail.com> wrote:
Hi Team,

How to list running container in singularity and how to stop it.? like in docker we have "docker ps" command. Anything like in singularity?

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.



--
Vanessa Villamia Sochat
Stanford University '16

Bangarusamy K

unread,
Nov 9, 2017, 3:53:57 AM11/9/17
to singu...@lbl.gov
Thanks for your email.

No not talking about instances.

For example, one non-root is working in one singularity container by executing $singularity shell image.simg.
As a root user, how I can check that. In order to kill / stop that container, like in docker docker container stop container id

On 09-Nov-2017 2:16 pm, "v" <vso...@gmail.com> wrote:
I thank you want the "instance" group of commands:


singularity instance.list
singularity instance.stop
singularity instance.start
On Wed, Nov 8, 2017 at 11:48 PM, Bangarusamy K <bangar...@gmail.com> wrote:
Hi Team,

How to list running container in singularity and how to stop it.? like in docker we have "docker ps" command. Anything like in singularity?

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.



--
Vanessa Villamia Sochat
Stanford University '16

v

unread,
Nov 9, 2017, 4:19:32 AM11/9/17
to singu...@lbl.gov
The instance.list command is the correct corresponding to docker ps, the general mapping is "show me the instances of running containers." But I think what you are asking about is more of a general list of container processes, and we don't have a good command for that. The key difference is that a uesr running a docker container is still running via docker (and the pid is kept track of) but for singularity, the final execv is to the run/shell so if you looked for a singularity process, you wouldn't find it. If you tried something like:

pgrep -fa singularity

you could get generally processes with singularity in the name, but that's not going to work for shell / run / anything because of what I just described. For example I just tried this, and my shell inside the container is just shown on my system as running bash. For this same reason you can't peep into /usr/local/var/singularity/mnt.

If you look in the session directory (usually tmp) you can get a hint of current (and sometimes non cleaned up) sessions:

 ls /tmp/.* | grep "singularity-runtime"

But that's not so useful. 

So I'm not sure I can offer a good solution, maybe others can comment. We don't have a central orchestration to keep track of all container processes, beyond the ones that are more by definition running as instances. When you have a bunch of container instances running, they each have associated namespace / pid and then when you run as sudo you can do things like list, stop all, etc. If you are interested in singularity being run on a cluster resource, you could use lmod to keep track of loads, and then look for singularity commands used in batch scripts. That could minimally give you a way to identify running jobs (with singularity) on your resource to stop, if needed.

Anyone have ideas for how/if we could implement an equivalent ps for a superuser?

To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.

--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity+unsubscribe@lbl.gov.

Bangarusamy K

unread,
Nov 9, 2017, 4:46:42 AM11/9/17
to singularity
Thanks for your update!.

Let's see, if someone could able to give some idea on this.
Reply all
Reply to author
Forward
0 new messages