Discussion: Have some docker-machine commands default to "default" VM? #1783
Comments
Great, thanks for writing this up @nathanleclaire ! |
This sounds reasonable to me. For the |
+1 - this could be implemented super-simply by simply using
Maybe naive, but couldn't we always assume the first argument is a machine name, except when there's no machine with that name, assume the active one instead? It's true that if there's a machine named Besides, in that (unusual) case I think it's reasonable to just let
But the simplest to implement may well be to just force users to provide the machine name to run commands. |
+1 😻 |
Yeah, I'm erring towards making the name always necessary to specifying if running an appended command, since that will lead to the most predictable behavior in general. This is really meant more as a shorthand than anything to get too clever. |
The real usage gain is for people working with only 1 docker local instance, and this enhancement will really lower the learning curve of docker. Pragmatically could we allow this for a subset of commands where there is always a predictable behavior. And explicitly don't allow it on command where it's the behavior is difficult to grasp (for instance |
Yes @jeanlaurent -- since one person using Docker with one VM is by far the most common Machine use case, this feature is intended to support that. How would everyone feel about having |
+1 |
1 similar comment
+1 |
I'm actually -1 on this. It would break the principle of least surprise. Almost every Can I suggest 2 things instead:
With this, the new user's experience looks like: $ docker-machine create
...A useful help message telling the user they need to specify a name, suggest `default` as a good default...
$ docker-machine create default
...A useful log message telling the user that they've chosen to use the default driver, which is `virtualbox`... This is still super simple for new users to get started with, and as a bonus it teaches them the concept of their newly-created machine having a name. When I help new users get started with Docker Machine, usually they start with the Docker Toolbox, and end up with a machine named |
I think it's a good consideration @hairyhenderson. I'm a bit on the fence about automatically setting |
To play devil's advocate, I'd say the "modern" programmer is likely to be fairly accustomed to being able to create and use VMs without having to specify a name, whether it's through |
Sure, but And, the If we're after the dead-simple lowest-barrier-to-entry-possible scenario, then we could add some interactivity, such as: $ docker-machine create
Creating a new machine! If you don't want this, Ctrl+C and run "docker-machine create --help"
Enter your machine's name here, or hit <enter> to name it "default": ⏎
Sweet. Give me a minute while I create your new virtualbox-based docker machine named "default"!
...
$ |
I think that we should first focus on commands users will use the most, in my opinion these are
after installation basic user don't have to deal with pretty much anything else. For sake of beginner user comfort it's reasonable change to command line UX. I'm not that fan of default machine name for create and rm, this is supposed to be executed by bit advance user and he should know what machine is he creating or deleting. Also it's not that common task. For ssh with let's say I have machine named |
@elmariofredo - yep - I'm in favour of defaulting to I agree about |
I've been using docker-machine for a while now and I feel the eval "$(docker-machine env myvm)" is a pain. I understand that it's good to understand that docker-machine operates against the machine currently set in the env variables. But couldn't we simplify this a bit. I usually have one vm for every project I'm working on and name them after the project. we have the docker-machine active to tell us which vm is active, why not let us set the active vm with it also docker-machine active myvm that way if I open up a new tab at most I would have to run the command above. It would be even better if docker-machine could have auto complete so that you only would have to type the first letter of the vm and press tab. |
In the original versions of Machine, commands like
docker-machine start
(without any arguments) would automatically run against the "active" machine. This was fine when Machine was directly embedded inside of Docker (a historical curiosity) but ultimately ended up being confusing and problematic so we removed it in favor of always specifying a target machine.With the introduction of the Toolbox and deprecation of boot2docker one of the pieces of feedback we are getting is that users miss simplicity of commands running automatically against a"default" machine. Since it is likely that the majority of users will have only one machine, and we now have what is essentially a canonical default VM in
default
, I am wondering if we might want to just default most commands to be referencingdefault
. The ambiguity would potentially be a lot less than the active tracking method, since there's no, "Wait, which host is active again?" conundrum.e.g.:
One tricky angle on this is
ssh
. Without arguments it works fine, but it's impractical for CLI to know if something likedocker-machine ssh ls
means "runls
command ondefault
machine" or "SSH into machine namedls
". So, that would need some thought.I don't really want to get into too much implicit behavior e.g. read the default host from a config file etc. because that's what we had before and it was damn confusing to debug when something went wonky. This might give us 80% of the way there without introducing too much difficult to follow behavior.
WDYT @ehazlett @tianon @hairyhenderson @bfirsh
The text was updated successfully, but these errors were encountered: