Custom docker container names

Is there a way to give custom names to the docker containers while using docker backend?
E.g. docker container spawned by logged in user jack will be named jack_<appName>.

1 Like

@Ben_Martin docker run has a --name option that allows assigning a name to the container when starting it then there’s docker container rename which allows to change the name of a running container. I don’t see a way of making use of them that doesn’t involve hacking shinyproxy. However there may be other ways of accomplishing what you’re trying to do with this. For example if it’s to find out who’s been using which app, you could enable info level logging then you’ll get the logged in user name with the app they used in the shinyproxy log.

@jkh1 thanks for the comment. My intention behind naming the containers is usually when a user needs some support with their container I can just take a look at the launched docker containers and determine which container belongs to which user and help them. But if there is no way to modify this behaviour I will try to see if I can modify the source code.
Regards.

Write down the results, it will be very interesting! I also really lack the ability to give an adequate name to a running container

1 Like

Hi

It’s currently not possible to give custom names to the containers created by ShinyProxy. However, there is a way to support your use-case. Every container started by ShinyProxy gets a set of labels providing some metadata about the container. You can use these labels to query for the container of a specific user, for example:

docker ps --filter "label=openanalytics.eu/sp-user-id=jack"

Or based on the id of the application:

docker ps --filter "label=openanalytics.eu/sp-spec-id=01_hello"

Or both:

docker ps --filter "label=openanalytics.eu/sp-spec-id=01_hello" --filter "label=openanalytics.eu/sp-user-id=jack"

I hope this helps!

1 Like