Comments (15)
Good catch, great info. Turns out Docker will not use the same ports when it's told to automatically restart containers when it restarts. It works on your second deploy because we basically manually restart the container with the right port. One option, as you said, is to rebuild the Nginx configs when docker restarts. Another option is to turn off automatic restart of containers when docker restarts and manually start them. The latter sounds more appropriate, but to me that makes it sound like a deficiency in docker (If we have to turn a useful feature off to do it right).
I'll poke around the Docker community and see how they feel.
from dokku.
Yeah. I've been scratching my head about this too. Seems kind of silly. Let me know what you find. I've been asking around IRC and the mailing list too as it seems to be a pretty fundamental problem.
If docker is for building a PaaS then having the ports stay after a reboot would have to be pretty fundamental I would have thought?
from dokku.
Have you guys considered using the IP addresses of the containers directly instead of using the docker port mapping feature? I have found the pattern to work quite well in situations like this: reverse proxy on the host (in another container, even, potentially), talking to pre-determined ports on the IP of containers -- easily exposed with docker inspect on the container ID. Since the containers are on the same subnet in the same bridge, they can easily talk between themselves. You only really have to re-map the reverse proxy container, if any!
from dokku.
@fujin That's a great idea. Seems a lot simpler. However, the same issue occurs. The IP addresses of the containers change on reboot unfortunately. Seems like the only way to go is to set all this stuff up on reboot unless the docker guys weigh in with a better alternative.
from dokku.
I've created a PR #88 that should address this issue that takes the nginx rewriting approach.
from dokku.
I've created an alternative solution relying on a central port registry that fixes this issue too. It's in PR #94
from dokku.
There's another problem with the nginx configuration template file which is imho the cause of the error.
Solved w/ pull request #95
from dokku.
👍 just ran into the exact same problem here.
from dokku.
Yeah. I've put in 2 PRs which I've been using in production now for about a month that solve the problem.
- #88 rewrites the ports on reboot
- #94 creates a central port registry and does static port assignments upon container creation to avoid the dynamic rewrite.
Either PR will fix the issue.
In a real PaaS there would be a routing layer such as hipache to manage the routing, so maintaining any port mappings is less important. @progrium has been saying that he'll chat to the docker guys to work out the best solution to this for dokku.
from dokku.
Thanks @eugeneware, should I just apply one of those PRs and follow the standard upgrade procedure?
from dokku.
@amaltson Yes. Though some of the changes affect the upstart scripts that get generated. If there's not too many deploys then it might be simpler to just do a fresh install. The main file you need to create and run is the dokku.conf upstart script. See the diff to see what it changes. Yell out if you have any problems.
from dokku.
I posted about this on the docker mailing list after having a chat on irc with @shykes from the docker team. Feel free to chime in: https://groups.google.com/forum/#!topic/docker-user/Py3YHb1C8Jo.
from dokku.
Thanks @asm89 I've put in my $0.02!
It sounds like on the face of it, from Solomon's response, that the only real reliable way to deal with the reboot issue is to use the docker API and reallocate ports (e.g. the approach in #88). That even if they try to keep the same ports after reboot (which would be nice!), that there is still the possibility with reconfiguration, or another service coming up before docker can grab the port - that the port mapping may not stick.
from dokku.
Flynn is working on a service discovery component that should help with
this issue nicely. If there are short term solutions, we can use them for
now, as long as they're marked short term and relatively modular (so we can
remove it later)
On Thu, Aug 15, 2013 at 8:50 PM, Eugene Ware [email protected]:
Thanks @asm89 https://github.com/asm89 I've put in my $0.02!
It sounds like on the face of it, from Solomon's response, that the only
real reliable way to deal with the reboot issue is to use the docker API
and reallocate ports (e.g. the approach in #88#88).
That even if they try to keep the same ports after reboot (which would be
nice!), that there is still the possibility with reconfiguration, or
another service coming up before docker can grab the port - that the port
mapping may not stick.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/82#issuecomment-22746239
.
Jeff Lindsay
http://progrium.com
from dokku.
Tagged the issue as "enhancement" for now. It should be improved when the service discovery component of flynn can be pulled in.
from dokku.
Related Issues (20)
- - ignore - HOT 2
- All app deploys fail HOT 4
- Dokku run fails with docker error: Conflicting options: --restart and --rm HOT 5
- Chaning ownership of storage file, Opreration not permitted HOT 8
- Issue with permissions during the deploy when using a legacy herokuish version HOT 2
- k3s plugin - add PV option
- buildpacks:set-property - odd behaviour
- Aborting a deployment of the release task fails HOT 5
- Openresty proxy: Not building `nginx.conf` and not updating `sudoers.d` with openresty varaint HOT 2
- Plugin creation doc references progrium site
- GIT_REV not set or updated with git:sync
- Deleting an app is not possible when Nginx is not running
- Send SIGTERM immediately to old containers when deploying via docker-local
- configuring Traefik healthchecks from app config HOT 1
- Feature Request: Implement config:import Command for Configuration from .env File HOT 5
- Add a method to force build when re-using an image with git:from-image HOT 1
- Failure injecting environment variables HOT 6
- Blue screen on deployed app HOT 1
- Ubuntu 24.04 support HOT 2
- App still running after Dokku `ps:stop` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokku.