# (SOLVED) Docker-Stack: Node-Red to access html://anothercontainer:port/snapshot.jpg

**URL:** <https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030>\
**Category:** General\
**Created:** [17 April 2020 19:48 UTC](https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030 "2020-04-17T19:48:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jodelkoenig](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jodelkoenig/32/44645_2.png) [@jodelkoenig](https://discourse.nodered.org/u/jodelkoenig)\
**Post date:** [17 April 2020 19:48 UTC](https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030/1 "2020-04-17T19:48:54Z")

</div>

Hi there,

I am having a problem that is driving me crazy. Just now 😅

I do have a working setup of two docker container running in the same network (nr\_default) started via docker-compose:

1. nodered - port 1880:1880
2. getcam - port 8844:80

(getcam grabs one snapshot.jpg per second from a webcam's rtsp stream and provides this file via lighttpd)

**What I can do:**

1. I can access the snapshot via _http:// **ip\_docker\_host** :8844/snapshot.jpg_, both, from nodered flows and from external web browser

2. I can also jump into the running nodered container and download the snapshot with _curl -O http:// **getcam** :80/snapshot.jpg_; name resolution of getcam is provided by Docker itself

**What I can't do:**

I would like to close most ports of my docker stack and therefore replaced _http:// **docker\_host\_ip** :external\_port_ with _http:// **container\_name** :internal\_port_ in below attached flow. But this doesn't show anything. Although the nodered container in principle is able to resolve getcam:80 as mentioned above. Weird.

Any hint to the right direction would be highly appreciated. Thanks.

```auto
[{"id":"2b768930.6f677e","type":"inject","z":"fa03549d.e12a88","name":"","topic":"","payload":"<html><img ng-src=\"http://192.168.2.100:8845/snapshot.jpg\"></html>","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":180,"y":340,"wires":[["94969a6e.b0dd1"]]},{"id":"94969a6e.b0dd1","type":"function","z":"fa03549d.e12a88","name":"","func":"return {\n template: msg.payload\n};","outputs":1,"noerr":0,"x":310,"y":340,"wires":[["d7d97ed9.b8d0a8"]]},{"id":"d7d97ed9.b8d0a8","type":"ui_template","z":"fa03549d.e12a88","group":"6c1d575b.2dfa78","name":"CAM","order":1,"width":"3","height":"2","format":"","storeOutMessages":false,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":430,"y":340,"wires":[["9835124d.4afbf"]]},{"id":"9835124d.4afbf","type":"debug","z":"fa03549d.e12a88","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":590,"y":340,"wires":[]},{"id":"6c1d575b.2dfa78","type":"ui_group","z":"","name":"Test","tab":"3e818533.347cba","disp":true,"width":"6","collapse":false},{"id":"3e818533.347cba","type":"ui_tab","z":"","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![jodelkoenig](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jodelkoenig/32/44645_2.png) [@jodelkoenig](https://discourse.nodered.org/u/jodelkoenig)\
**Post date:** [17 April 2020 20:43 UTC](https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030/2 "2020-04-17T20:43:07Z")

</div>

OK. One step further ...

On the dashboard pictures get embedded with the very same address, that I put into the flow. Consequently they are not shown if I referred nodered to the docker-internal container-name. Latter does not resolve for an "external" dashboard viewer since they do not have access to the docker internal DNS service.

Now I need to find a way to overcome this barrier 🙂

Still open for tips.

---

<div class="post-metadata">

**Author:** ![jodelkoenig](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jodelkoenig/32/44645_2.png) [@jodelkoenig](https://discourse.nodered.org/u/jodelkoenig)\
**Post date:** [17 April 2020 22:21 UTC](https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030/3 "2020-04-17T22:21:10Z")

</div>

For the sake of completeness:

a) Don't give up. Take a break. Try a different perspective. ... this quite often helps to find a solution 😂

b) The solution is:

- docker-compose.yml

- settings.js

- http-address in the flow

Note: I have choosen _.data/nodered/snapshot/getcam1_; ._data/nodered/snapshot/getcam2_; ._data/nodered/snapshot/getcam3_ for my various rtsp-cams. With this I can reference to the individual cam in each flow's http-address correspondingly.

Thanks for listening to my self-learning-and-talking-exercise 🤣

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 May 2020 22:21 UTC](https://discourse.nodered.org/t/solved-docker-stack-node-red-to-access-html-anothercontainer-port-snapshot-jpg/25030/4 "2020-05-01T22:21:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
