I have two nginx containers running.
One is listening on port 80 the other 8080.
Here is how I run them:
sudo podman run --rm \
-t \
-p 8080:80 \
--publish-all \
--name nginx-two \
-v ./html2/:/usr/share/nginx/html \
-v ./html2/conf/default.conf:/etc/nginx/conf.d/default.conf \
-d nginx
The second:
sudo podman run --rm -t -p 80:80 --name nginx -v ./html/:/usr/share/nginx/html -v ./html/conf/conf.d:/etc/nginx/conf.d -d nginx
NGiNX config:
location / {
proxy_pass http://10.88.0.37:8080;
}
I also tried:
location / {
proxy_pass http://127.0.0.1:8080;
}
This config is used by the --name=nginx
container.
Here is the error I get:
2020/01/26 15:33:05 [error] 8#8: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 10.88.0.1, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "localhost"
10.88.0.1 - - [26/Jan/2020:15:33:05 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0" "-"
Is there way to make these containers communicate with each other?
I also tried using --pod
. But then got this error:
Error: cannot set port bindings on an existing container network namespace