How do I set up linkage between Docker containers so that restarting won't break it?

前端 未结 11 2257
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 05:40

I have a few Docker containers running like:

  • Nginx
  • Web app 1
  • Web app 2
  • PostgreSQL

Since Nginx needs to connect to the

11条回答
  •  日久生厌
    2020-12-02 05:54

    This is included in the experimental build of docker 3 weeks ago, with the introduction of services: https://github.com/docker/docker/blob/master/experimental/networking.md

    You should be able to get a dynamic link in place by running a docker container with the --publish-service arguments. This name will be accessible via the DNS. This is persistent on container restarts (as long as you restart the container with the same service name that is of course)

提交回复
热议问题