-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$CurrentContainer is null #355
Comments
Hi @multicast, this looks like it might be another instance of nginx-proxy/nginx-proxy#1529 Could you give me the output of those commands? docker inspect yournginxproxycontainer
docker exec yournginxproxycontainer nginx -T
docker exec yournginxproxycontainer cat /proc/1/cpuset
docker exec yournginxproxycontainer cat /proc/self/cgroup
docker exec yournginxproxycontainer cat /proc/self/mountinfo |
Hi @buchdag, I also found your comment nginx-proxy/nginx-proxy#1586 (comment) and went through referenced issues, but had no time to finish analysis or patch on getting container id. I tried to understood how the Here is the output of commands. The first nginx is using
nginx -T with my change to
cpuset:
cgroup:
mountinfo:
|
The inspect was lost in paste:
|
@multicast I confirm this is another instance of a docker-gen issue we already encountered and fixed multiple time. Short version is there is no clear and stable mechanism to get the ID of a container from inside the container itself. At the moment docker-gen tries to extract the 64 characters container ID from a set of three files. In your case the first two ( I'm transferring this issue to nginxproxy/docker-gen. |
Removing the custom |
Removing the custom hostname fixed the problem, thanks. |
@multicast I pushed a version of nginx-proxy built with a patched docker-gen, can you tell me if it works for you even with the custom hostname ? docker pull nginxproxy/nginx-proxy:dg355 |
Yes, I was checking :latest an hour after you merged, but still had to change the hostname. |
@multicast the fix is now available in |
After a while I updated manually to
:latest
image from docker hub and all my containers ended up with upstreamserver 127.0.0.1 down;
.I copied
nginx.tmpl
, and after a while I found out{{ $CurrentContainer := where $ "ID" .Docker.CurrentContainerID | first }}
returnsnull
, so this range can never set$server_found
to true.Change from
$CurrentContainer.Networks
to$container.Networks
(from outer range) solved the problem.I am running Debian Bullseye (daily dist-upgraded until Bullseye is stable), and docker-ce vevrsion 5:20.10.7~3-0~debian-bullseye from docker.com (i.e. not debian-packaged docker).
Can somebody confirm this behavior? I can make pull request.
The text was updated successfully, but these errors were encountered: