-
Notifications
You must be signed in to change notification settings - Fork 106
Conversation
Thanks for the pull request. I apologize for the delay, but I'm currently on the road with limited Internet access, so I'll take a look once I'm back (should be early August). |
Since probably in almost all cases docker-osx-dev would be run against the active machine, I think you could drop the requirement to set the machine name environment variable on every invocation, and instead just use |
@brikis98, no problem, I still have to add some tests. @ilkka, sorry getting ahead of you, but I needed it this week.
Also, I am trying to maintain compatibility with boot2docker. Later if needed we can drop support for it. |
################################################################################ | ||
|
||
function get_json_val () { | ||
python -c "import json,sys;sys.stdout.write(json.dumps(json.load(sys.stdin)$1))" | sed -e 's/^"//' -e 's/"$//' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit concerned about adding a dependency on python. Any alternative way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed! That is a hard one and I will have to think better on this. I saw it is possible to do with sed, grep and awk.
Some examples that I saw using grep actually use GNU grep, which is not always available on OSX. I am open to any suggestion.
Thank you for the PR. This is a pretty massive change that forks the code in quite a few places. Do we know for sure that using boot2docker directly via the CLI is deprecated? Is docker-machine definitely the way to interact with Docker on the desktop in the future? If so, it's worth thinking about supporting only docker-machine. This project is hard to test (see #7), so I worry about any complications that fork the code too much. |
The boot2docker-cli deprecation notice is here: https://github.com/boot2docker/boot2docker-cli#pending-deprecation I have used docker-machine locally on OS X and it seems to work just fine, not sure if there's any reason to keep supporting the boot2docker-cli instead. Maybe somebody from Docker or somebody that has more knowledge around that can chime in. |
Hmm, the Docker Docs still point to boot2docker and using it as a command line tool. |
Thanks @brikis98 for the feedback! I made some changes but, for me, there are at least two things outstanding:
Regarding the boot2docker deprecation, my understanding is that it is slowly being deprecated. I'd suggest for now keeping support for both |
OK, let's keep the boot2docker support a bit longer. Let me know if you have ideas on the JSON & automated test front. |
@labianchin, multiple active? I thought the active machine was determined by DOCKER_HOST in the env, meaning there can only be one? |
just tried this branch again and noticed a weird thing: my freshly generated virtualbox docker machine has a config like this:
which makes |
Ah, now I understand what is happening with |
@ilkka, Yes. That makes more sense when you use a driver like EC2, OpenStack or GCE. This way you can have multiple docker-machine active (and running) in the cloud. You might want to have a docker-machine per each project you have. So in one terminal tab you can run:
And in the other:
|
@ilkka Thanks for catching that! I was testing more with the openstack driver. There the |
So I was looking into what is the arguments
So, I just removed the But, one problem I am getting is that even after It seems rsync 64bits is now available for |
@labianchin ah yes, but since active is stored in the env, it is per terminal session, so you can run multiple machines that way too, just in separate terminals. Essentially it's the same. I don't mind having the parameter, I just think that defaulting to whatever
I found that I had to |
@labianchin: Yes, if the 64 bit rsync is now working, we should go back to using |
@ilkka, that make sense. I agree that would be a good default. But if, for now, we are keeping the support for boot2docker, then it would be better to keep the default (no Also, I just run
But when I run
That is weird. |
Fix port parameter in do_rsync Install will add to host based on docker-machine name and ip Install does not set the environment when using docker-machine
- pass --machine-name as argument, instead of env var - ssh command working also for boot2docker ssh - add_docker_environment_variables function that adds env vars only for boot2docker - add doc and rename get_json_value
} | ||
|
||
# | ||
# Configures variables based on a the docker-machine inspect from $DOCKER_MACHINE_NAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor typo: "a the"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@labianchin: Thanks! I just left a bunch more comments. Almost there. |
@labianchin that |
docker-machine start "$DOCKER_MACHINE_NAME" | ||
eval $(docker-machine env "$DOCKER_MACHINE_NAME") | ||
configure_docker_machine | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here, this eval will run something like this:
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.103:2376"
export DOCKER_CERT_PATH="/Users/someone/.docker/machine/machines/local"
export DOCKER_MACHINE_NAME="local"
We can see that DOCKER_MACHINE_NAME
will be redefined.
Also, as in the docker-machine
documentation, if the user runs eval "$(docker-machine env <machine-name>)"
, it will define the DOCKER_MACHINE_NAME
to the env. Then if he runs docker-osx-dev
, he would not need to pass the --machine-name
argument.
I guess this is fine, I can add to the Readme.md
about this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@brikis98 thanks for the feedback, I will be making the fixes. @ilkka Please see this: #77 (comment) So running |
One idea I've tinkered with is some kind of |
Yes @nathanleclaire, I would be interested! Can you provide some details on what you have in mind? Probably via e-mail. Thanks! |
@brikis98 I think I got all the suggested fixes in this last commit. Can you take a look? |
|
||
# | ||
# Read a json string from stdin and return the value of the key provided as first argument | ||
# Uses head -n 1 to avoid duplicates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an implementation detail. Instead, you should probably say something along the lines of "Does a simple string search and returns the first string value that matches the given key".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@labianchin: A few more questions/comments above :) |
Hey @brikis98, I've made some fixes. Please also see my previous comments. |
``` | ||
> docker-machine create --driver virtualbox <machine-name> | ||
> eval "$(docker-machine env <machine-name>)" | ||
> docker-osx-dev install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, just realized I have one more question on this: do you have to run the install
command every time you run docker-machine create
? Or only the eval
part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I am little confused on what should be the role of the install
for docker-machine
.
install_dependencies # Should actually run before docker-machine create. Once for osx user.
init_docker_host # Per machine, should run after docker-machine create. This seems only important for the next command
install_rsync_on_docker_host # Is this really important? the sync will also install rsync.
add_docker_host # Per machine, should run after docker-machine create. Also, is it important?
add_environment_variables # Not used for docker-machine
I would avoid making the install
create the docker-machine, as in the creation the user needs to supply the driver he wants and all the driver's configuration. It is also seems misleading that a install
command would create a machine.
I'd suggest the following flow:
docker-osx-dev install_dependencies # once per osx user
docker-machine create --driver virtualbox <machine-name>
eval "$(docker-machine env <machine-name>)"
cd /foo/bar
docker-osx-dev
In this way there is no need to run install
after docker-machine create
. The install
would only make sense for boot2docker
.
I expect developers to run the
This is why it includes
The question I asked earlier, though I guess not very clearly, was whether the |
Yes. That really make sense. Thanks for clarifying. Answering your question: I believe it shouldn't, as users might want to switch between different docker-machine instances (machines). So every time they run So, clarifying, this steps, should run just after creating a new machine instance: eval "$(docker-machine env <machine-name>)"
docker-osx-dev install Which is equivalent of: docker-osx-dev --machine-name <machine-name> install After the instance is created and eval "$(docker-machine env <machine-name>)"
docker-osx-dev Or the equivalent: docker-osx-dev --machine-name <machine-name> |
Adds support for docker-machine
Awesome, thanks for the PR. It's now merged. |
Thanks for all the feedback! That has been a great experience contributing to this project. |
Related to issue #50.
Although it is already working I'd still consider this as a preview.
It seems to be missing to update Readme, add tests and improve the install (e.g. add_environment_variables is not important for docker-machine).
Can you please provide some feedback? And also what would you expect to get this merged?