Nginx proxy manager in docker and lxc container help needed

I can’t figure out how to do this or even make it work.
On my host, I have one lxd container running jupyter and it has reverse proxy set like this:
lxc config device add ju_lxd port5000 proxy listen=tcp: connect=tcp:
And then I have docker running on my host and one of the docker containers is running npm( Nginx proxy manager).
Before npm, I had nginx runnig on my host and configure it manually. And for jupyter container I had settings like this:

server {
    root /var/www/;
    index index.html index.htm index.nginx-debian.html;


listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
    location  / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header Host $host;
            proxy_read_timeout 86400;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

Everything worked fine, when the host was running nginx. But with npm, I can’t figure out how to connect to the lxd container or how to redirect to the lxd container. I tired with containers own ip and host own ip, but no.
What might be blocking the connetion?

Your LXD proxy device ju_lxd will be listening on 127.0.01: 5000 on your LXD host.
It will forward connections to that port into your LXD container to inside the container.

You are then running NPM inside a docker container (which itself has its own network namespace which will provide its own address), so configuring NPM to connect to will not connect to your LXD host’s port but instead the inside your NPM docker container (think of them like separate machines connected).

I’m not super familiar with docker, but assuming the NPM container can make outbound connections to your LXD host then you could setup the LXD proxy device to listen on a different IP that is still local to your LXD host but is not Do you use a lxdbr0 bridge? If so you could get your LXD proxy device to listen on that IP, and then have the docker NPM connect to that.

Can’t figure out. Didn’t know about lxdbr0, looks like I’m using it.
So my lxdbr0 ip is and containers ip is
So tired to add new network for container like this:
lxc config device add ju_lxd port5003 proxy listen=tcp: connect=tcp:
But you can’t listen that . (wrong idea?)
Then tired this:
lxc config device add ju_lxd port5003 proxy listen=tcp: connect=tcp: And it let my create one. Great.
But when I forward npm to, nothing happens…Made second
bridge, but I don’t know how to add my container to that…

Looks like you got the ip and port merged in npm,*

Why don’t you just get npm to connect to and remove the proxy device?

You’ll need to make sure the target service isn’t just listening on though.

I did remove all the devices. Made jupyter listen Set npm re-direct to Still nothing. I was like “this should work!!! Why Why??” Then I tired one more thing. Change https to http and it worked…
I thing it would even work with devices…
Well now I learned what is lxdbr0 ( maybe) and how to add and remove devices from lxd container. Thanks.

1 Like