Giancarlo
Giancarlo

Reputation: 179

link from ngnix installed outside docker to a container

friends, I have a ubuntu server with ngnix installed outside of docker.

I have a docker image that has a web application, with an ip for example: 172.17.0.3 (all within the same server)

How can I do it from my nginx to the ip of the name container? for example: "ip container docker"

That structure cannot change, that's how aws service creates it. * obs: the Ip can change because of that I need as a dynamic variable.

upstream openerp {
server "ip container docker":8069;}

use: $host or hotname, not work

Upvotes: 0

Views: 39

Answers (1)

Alexandr Shurigin
Alexandr Shurigin

Reputation: 3981

You should publish your docker container port on the docker host and use server 127.0.0.1:your_mapped_docker_container_port.

Read more details in the docker docs https://docs.docker.com/config/containers/container-networking/#published-ports

This way docker will take care of everything docker networking related under the hood.

Upvotes: 1

Related Questions