-
Notifications
You must be signed in to change notification settings - Fork 2k
Made docker engine port configurable #4034
base: master
Are you sure you want to change the base?
Conversation
1506d56
to
e8244cc
Compare
de942a5
to
93872a6
Compare
@wdullaer : this sounds like a good idea! (making the port not hard-coded / configurable by drivers) I needed this for KVM (qemu), but ended up making my own patch since I didn't found this one in time... Will see if it is possible to merge these two somehow, as I'm using it for "user" networking with KVM. https://www.linux-kvm.org/page/Networking#User_Networking It is not perfect either way, since I have one port on the VM "outside" and one port on the VM "inside":
For now, I just made it always return 2376 for when it's checking inside and after that return the real port |
It's been half a year since I worked on this code, so it's not exactly fully in my head right now, but I had a quick look at your code and the diff doesn't seem to be that large. I covered a lot more drivers than the commit you referred to, but I did seem to have missed the reference to the defaultPort in the boot2docker provisioner. I see that your |
About the error code, you are probably right - there was some quick copy/paste involved :-) Happy to help with the merge, basically I just wanted to override the if d.Network == "user" {
d.SSHPort, err = getAvailableTCPPort()
if err != nil {
return err
}
d.EnginePort, err = getAvailableTCPPort()
if err != nil {
return err
}
} func (d *Driver) GetIP() (string, error) {
if d.Network == "user" {
return "127.0.0.1", nil
}
return d.NetworkAddress, nil
}
func (d *Driver) GetPort() (int, error) {
return d.EnginePort, nil
} It's not like there ever is any error... ( https://wiki.qemu.org/Documentation/Networking#User_Networking_.28SLIRP.29 |
As far as I can tell, compared to your branch, I just missed the boot2docker provisioner, which I can add when I find an hour somewhere this week. How do you propose to do the merge? I fix this branch up and you merge it into yours? We wait until this one gets merged by the maintainers? |
@wdullaer : If you fix your branch (for boot2docker), then I can just use that instead of mine Have been working on the driver instead. It's not the end of the world for it without GetPort(),
Of course, it would look better with our additions and actually testing the right thing (port)... |
Please sign your commits following these rules: $ git clone -b "engine-port" git@github.com:wdullaer/machine.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354159728
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f Amending updates the existing PR. You DO NOT need to open a new one. |
I've updated the PR with the fixed boot2docker provisioner. (I realized that the docs should also be updated to reflect the new --engine-port flag, but they're not maintained in this repository) |
@wdullaer : tried it out now, works fine. I had to rewrite my plugin, but that was for the best. That change was for the better, anyway. Only comment remaining is that you forgot to put the |
That's great news! I'm happy this was useful for you. If the biggest concern is about the formatting of the commit message, I consider that a succes. I also hope it gets merged at some point, but I have no idea who to talk to to move this forward to be honest |
Introduced -engine-port flag in create subcommand Extended drivers interface with a GetPort() method Updated all drivers with the new interface Updated provisioning to use GetPort() rather than parse GetURL() for the port Made driver options for setting the engine port emit a useful error message Fixes docker-archive-public#3361 Signed-off-by: Wouter Dullaert <wouter.dullaert@gmail.com>
Extended drivers interface with a
GetPort()
methodUpdated all drivers with the new interface
Updated provisioning to use
GetPort()
rather than parseGetURL()
for the portMade driver options for setting the engine port emit a useful error message
Fixes #3361
I think the behaviour of emitting a useful error for the driver flags that are replaced by -engine-port is a good compromise between being helpful without overcomplicating the code with backwards compatibility
Theoretically you could argue that the engine port should go in the engine options, rather than the driver options, but the way the code is structured this is very unwieldy. (especially because drivers like the aws one will need to tweak firewalls / security groups to make everything work)
As a side remark: the build and tests don't work if you have spaces in your source path somewhere.
I haven't been able to completely fix this, but if I do I'll open a separate PR