Git Product home page Git Product logo

Comments (15)

progrium avatar progrium commented on May 18, 2024

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.

eugeneware avatar eugeneware commented on May 18, 2024

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.

fujin avatar fujin commented on May 18, 2024

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.

eugeneware avatar eugeneware commented on May 18, 2024

@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.

eugeneware avatar eugeneware commented on May 18, 2024

I've created a PR #88 that should address this issue that takes the nginx rewriting approach.

from dokku.

eugeneware avatar eugeneware commented on May 18, 2024

I've created an alternative solution relying on a central port registry that fixes this issue too. It's in PR #94

from dokku.

giefferre avatar giefferre commented on May 18, 2024

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.

amaltson avatar amaltson commented on May 18, 2024

👍 just ran into the exact same problem here.

from dokku.

eugeneware avatar eugeneware commented on May 18, 2024

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.

amaltson avatar amaltson commented on May 18, 2024

Thanks @eugeneware, should I just apply one of those PRs and follow the standard upgrade procedure?

from dokku.

eugeneware avatar eugeneware commented on May 18, 2024

@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.

asm89 avatar asm89 commented on May 18, 2024

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.

eugeneware avatar eugeneware commented on May 18, 2024

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.

progrium avatar progrium commented on May 18, 2024

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.

asm89 avatar asm89 commented on May 18, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.