# Img can't display in Node-red running in docker

**URL:** <https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787>\
**Category:** Dashboard\
**Created:** [17 May 2020 09:32 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787 "2020-05-17T09:32:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaofei207](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gaofei207/32/13047_2.png) [@gaofei207](https://discourse.nodered.org/u/gaofei207)\
**Post date:** [17 May 2020 09:32 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787/1 "2020-05-17T09:32:36Z")

</div>

Hi all, I have setup node-red in docker on ubuntu 16.04.6.  
I have changed the settings.js (home/gaofei/.node-red) to

```auto
httpStatic: '/home/gaofei/img',

```

and I add a ui\_template and config it as

```auto
<div class="c1">
<img src="/3.jpg" height="400" width="400" ><br/>
</div>

```

But the img can not be displayed successfully.

docker logs mynodered

```auto
> node-red-docker@1.0.6 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"

17 May 08:35:18 - [info]

Welcome to Node-RED
===================

17 May 08:35:18 - [info] Node-RED version: v1.0.6
17 May 08:35:18 - [info] Node.js version: v10.20.1
17 May 08:35:18 - [info] Linux 4.4.0-151-generic x64 LE
17 May 08:35:18 - [info] Loading palette nodes
17 May 08:35:19 - [info] Dashboard version 2.22.1 started at /ui
17 May 08:35:19 - [info] Settings file : /data/settings.js
17 May 08:35:19 - [info] HTTP Static : /home/gaofei/img
17 May 08:35:19 - [info] Context store : 'default' [module=memory]
17 May 08:35:19 - [info] User directory : /data
17 May 08:35:19 - [warn] Projects disabled : editorTheme.projects.enabled=false
17 May 08:35:19 - [info] Flows file : /data/flows.json
17 May 08:35:19 - [info] Server now running at http://127.0.0.1:1880/
17 May 08:35:19 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

17 May 08:35:19 - [info] Starting flows
17 May 08:35:19 - [info] Started flows
17 May 08:36:16 - [info] Stopping flows
17 May 08:36:16 - [info] Stopped flows
17 May 08:36:16 - [info] Starting flows
17 May 08:36:16 - [info] Started flows
17 May 08:36:25 - [error] [file in:read mp3] Error: ENOENT: no such file or directory, open '/img/1.mp3'

```

If just running node-red in WIN10 or Ubuntu , not installed in docker ,the img can show successfully.  
I have tried to change the ui path in settings.js and it works,so it proves that the settings.js file I modified is the correct one.

Could you please give some advise ?

Thanks .

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 May 2020 09:41 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787/2 "2020-05-17T09:41:35Z")

</div>

Hi. I'm am by no means a docker expert but I'm fairly certain you can't simply access directories on the host.

Perhaps this would help?

> **[How To Share Data Between the Docker Container and the Host | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-share-data-between-the-docker-container-and-the-host)**
>
> In general, Docker containers are ephemeral, running just as long as it takes for the command issued in a container to complete. By default, any data created inside the container is only available from within the container and only while the...

---

<div class="post-metadata">

**Author:** ![gaofei207](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gaofei207/32/13047_2.png) [@gaofei207](https://discourse.nodered.org/u/gaofei207)\
**Post date:** [17 May 2020 12:23 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787/3 "2020-05-17T12:23:30Z")

</div>

Thanks for your reply. I use the command:  
`docker run -it -p 1880:1880 -v /home/gaofei/.node-red:/data --name mynodered nodered/node-red`  
So the host `/home/gaofei/.node-red` directory is bound to the container `/data` directory.

I also tried to copy img to /data/ directory or /home/gaofei/.node-red , still no effect.

---

<div class="post-metadata">

**Author:** ![gaofei207](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gaofei207/32/13047_2.png) [@gaofei207](https://discourse.nodered.org/u/gaofei207)\
**Post date:** [17 May 2020 12:47 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787/4 "2020-05-17T12:47:01Z")

</div>

Solved .

```auto
httpStatic: '/data/img',

```

---

<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:** [31 May 2020 12:47 UTC](https://discourse.nodered.org/t/img-cant-display-in-node-red-running-in-docker/26787/5 "2020-05-31T12:47:07Z")

</div>

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