Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Docker version: Running 2 sites/containers at same time #1393

Closed
rfay opened this issue May 30, 2017 · 5 comments
Closed

Docker version: Running 2 sites/containers at same time #1393

rfay opened this issue May 30, 2017 · 5 comments

Comments

@rfay
Copy link

rfay commented May 30, 2017

Issue Type

  • Bug Report / Support Request

Your Environment

, docker-compose
docker-compose version 1.13.0, build 1719ceb

Your OS

  • macOS (MacOS Sierra)

Summary

I was trying to see what would happen with the docker version of drupalvm and having 2 sites up at one time, but it didn't appear to be possible. Although I changed the network ranges so they didn't overlap and the IPs in there, it still failed on port binding, for example:

ERROR: for drupal-vm  Cannot start service drupal-vm: driver failed programming external connectivity on endpoint randyfay (9ce55e6e97f768767d6d35a2e01a0fc12328bf759f0a442c4e588ee5be239a1a): Bind for 0.0.0.0:3306 failed: port is already allocated

It appears that it's still not possible for docker-for-mac to bind to the same port on different IP addresses for different containers?

Attached are the two docker-compose files that I used (in zip)

composefiles.zip

@geerlingguy
Copy link
Owner

@rfay - Yeah... I ran into that last week as well, just didn't have any time to post an issue for it.

I got so excited I could alias an IP address to localhost... that I forgot that Docker was still just using localhost and binding to port 80 on 0.0.0.0 still :(

Which means the Docker-based solution will definitely have to wait (if you do anything else with port 80/443 on your local machine) until moby/moby#22753 is fixed. At least that's how I'm currently reading the situation. Maybe there's some better solution using the 192.168.65.1 IP address? Not sure yet.

@rfay
Copy link
Author

rfay commented May 31, 2017

Thanks! Maybe docker will get their act together before long :)

@geerlingguy
Copy link
Owner

It would be nice if Docker for Mac worked like Docker for Linux (and most of the time, Docker for Windows) works with regard to networking—apparently it's mostly a solved problem in 10.12, but Docker for Mac doesn't include full support for bridge networking on Mac because it's supported for 10.10 and 10.11 still :/

@geerlingguy
Copy link
Owner

Eek, another annoying thing I uncovered today—if you forget to delete the alias and try using the same IP address for something else (e.g. a Vagrant box), then it'll screw with networking a bit.

So I updated the Docker instructions to:

  1. Add an alias IP address on the loopback interface: sudo ifconfig lo0 alias 192.168.89.89/24
  2. When you're finished using the container, delete the alias: sudo ifconfig lo0 -alias 192.168.89.89 (or restart your Mac).

@geerlingguy
Copy link
Owner

I'm going to close this as a known issue for now—basically you can only run one Drupal VM Docker instance at a time if you're on Mac or Windows (for Linux, it should work with more than one). Hopefully it gets fixed upstream by Docker for Mac/Windows networking getting a bit more intelligent, but it seems that until Docker CE drops support for 10.11 or 10.12, the networking layer will be missing some major required improvements :(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants