roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Easy context switching in Docker Desktop

Open iben12 opened this issue 5 years ago • 17 comments

Tell us about your request I would like to see an easy docker context switching menu in Docker Desktop. Basically the same as there is for Kubernetes for switching kubeconf contexts. I do not expect it to be GUI for managing contexts (create/update/rm), just switch.

Which service(s) is this request for? Docker Desktop (all platforms)

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard? Switching context is possible by docker context use mycontext which is not much, but why couldn't we have it in two clicks in parity with the Kubernetes menu item?

Are you currently working around the issue? n/a

Additional context none

iben12 avatar Mar 28 '20 09:03 iben12

Hey @iben12 thanks for raising this! I like the idea of adding it like the K8s context, do you think there would be no value in the ability to add via the main UI as well? And do you think we should do anything with the 'whale icon' in the menu bar to indicate what context people are using? 🤔

nebuk89 avatar Apr 03 '20 09:04 nebuk89

Well, I was aiming on something that needs minimal effort, but would make life a tiny bit easier. Regarding a UI that makes possible to manage contexts (if you meant that), that would be a great addition, especially for less experienced users.

For the icon to indicate current context, honestly I don’t know. If someone has multiple contexts, how could that appear on the tiny icon? However, and I had issues with that in my own experience, if just indicating if I’m on local or a remote context would be possible, that could really help. I took me a couple of minutes and commands to realize that why I don’t get the results I was expecting was because I was on a remote context.

iben12 avatar Apr 03 '20 13:04 iben12

Hi @iben12 . I'm currently working on the user experience of the context switching issue you brought up and would really like to get a better sense of how you are currently using contexts and how often you're switching. Any insight you could give would be helpful. For example, how many remote contexts do you usually work with? Are there any ways switching could be improved? You mentioned having a clearer marker into which context you're in to avoid confusion. What specific tasks are you usually attempting to complete when context switching? Thanks again for raising this!

stlucek avatar Jun 16 '20 08:06 stlucek

Hi @stlucek, At the moment I use two contexts: the local (default) and one remote for my swarm cluster. I switch between them on a daily basis. Of course mostly I work with the local context, but every now and then I need to change stuff in the swarm (deploy, update, restart services, stacks etc).

I have an alias set up in my .zshrc so I use dctx <context> to switch between them.

However I have another addition: sometimes I forget on what context I am on and do not understand why something (eg mounts, port mappings) do not work. When I use a docker command on a remote context, it would be really nice if the first line of the output would be something like: Notice: You're using a remote Docker context, your command is executed on a remote server.

Above was kind of an idea that the Moby icon on the taskbar/panel could indicate the context: at least it could somehow indicate whether local or remote. That could be achieved, I guess.

Just ping me if I can help any further.

iben12 avatar Jun 19 '20 17:06 iben12

I'm going to add docker/for-mac#5512 into this request: if you could switch contexts in Docker Desktop, we would also need the dashboard to switch to reflect the current context (or show both, or something). Arguably the dashboard should switch even while context switching is only on the CLI, although we would have to have a way to indicate the current context at least otherwise it would be confusing.

stephen-turner avatar Mar 28 '21 10:03 stephen-turner

I don't have any containers on my workstation, everything is remote. It would be nice to have Docker Workstation to be able to talk to remote docker instances using context's.

casperghst42 avatar Mar 28 '21 17:03 casperghst42

I put this thing together (it was a bit of a learning go project) that at least serves as a visualizer for windows: https://github.com/sthomen/godockercontext It just observes the config.json file and updates a simple colored systray icon. It may work on mac and linux as well, but I haven't tested that. Perhaps it's useful to some you guys.

Feel free to delete this comment if it is inappropriate here.

sthomen avatar Jan 07 '22 20:01 sthomen

Hello. I really think this is a good ideea - but until then, @iben12 , you mentioned that docker context switch works with the cli - which is true - but does the change currently reflect intor Docler Desktop? I am able to do all the work using the cli, but the Desktop seems to show only one context, no matter what. Any ideas please?

security-intel avatar Sep 27 '22 15:09 security-intel

I've found the same behavior: docker desktop only uses the desktop-linux context

smrfeld avatar Sep 27 '22 22:09 smrfeld

Yes I have observed same. By default docker desktop is using desktop-linux context. But in the linux when we pull docker image from docker hub its pulled in default context. So when I open docker desktop it shows nothing.

hareesh43 avatar Mar 17 '23 11:03 hareesh43

@iben12 , thanks for creating this issue. we're actively looking in to this again and aiming to ship something in the near future supporting this use case. apologies for the delay.

would love to chat with anyone on this thread that might be willing to spare 30 mins. please message me on [email protected] and I can schedule some time for us. or give this comment a 'thumbs up' and i can find your email address via profile / reach out on linkedin / etc !

christophermclellan avatar May 16 '23 13:05 christophermclellan

I just ran into this issue on Ubuntu 22.04. I want to use an nvidia gpu in my container, but the nvidia container toolkit expects to work with the default context, so for gpu enabled containers I need to use that, and the containers/images are not visible in the docker desktop gui.

I suspect the situation is not straightforward based on this doc page, but wondering if it's currently possible to update some config of Docker Desktop to make it use a context different from desktop-linux

lacaSG avatar May 19 '23 10:05 lacaSG

I just ran into this issue on Ubuntu 22.04. I want to use an nvidia gpu in my container, but the nvidia container toolkit expects to work with the default context, so for gpu enabled containers I need to use that, and the containers/images are not visible in the docker desktop gui.

I suspect the situation is not straightforward based on this doc page, but wondering if it's currently possible to update some config of Docker Desktop to make it use a context different from desktop-linux

Same thing I was wondering, Im on mac.

surajmandalcell avatar Aug 15 '23 20:08 surajmandalcell

any updates on this one?

eugenweissbart avatar Nov 08 '23 06:11 eugenweissbart

And how to use docker context that connects with ssh to another machine? And what if I want to manage docker engine on some different servers? Docker desktop is just unusable thing now(

truemoroz avatar Mar 11 '24 01:03 truemoroz