# Please help me "moving" Node-Red docker to docker compose. (retaining data)

**URL:** <https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188>\
**Category:** General\
**Tags:** docker\
**Created:** [25 November 2023 21:14 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188 "2023-11-25T21:14:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)\
**Post date:** [25 November 2023 21:14 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188/1 "2023-11-25T21:14:42Z")

</div>

My nodered is currently based on  
`docker run -it -p 1880:1880 -p 161:161/udp -p 162:162/udp --name noderednew nodered/node-red`  
docker start noderednew

yes, I am aware of [Running under Docker : Node-RED](https://nodered.org/docs/getting-started/docker)

if I added this section to my docker-compose.yml ...

```auto
services:
  node-red:
    image: nodered/node-red:latest
    environment:
      - TZ=Europe/Amsterdam
    ports:
      - "1880:1880"
      - "161:161"
      - "162:162"
    volumes:
      - node-red-data:/data

```

..then I would not expect it to work, I mean ... something should be renamed to "noderednew" (as the current name is that.)

I would really like to change the service name from "noderednew" to "nodered - and just lest docker compose run it, with all the current data.  
How should I proceed?

---

<div class="post-metadata">

**Author:** ![TerryE](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/terrye/32/65423_2.png) [@TerryE](https://discourse.nodered.org/u/TerryE)\
**Post date:** [25 November 2023 22:28 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188/2 "2023-11-25T22:28:37Z")

</div>

D-C is really just a management wrapper around the docker runtime to allow you to create, maintain, stop/start projects containing one or more docker images, with a declarative YAML interface. The D-C project will use the same nodered image and so long as you map the same named volume to this, then the new project container will inherit the same runtime environment. I assume that you have read and are familiar with the [Running under Docker](https://nodered.org/docs/getting-started/docker) tutorial.

It is always wise to create a regular backup of your project especially before doing this sort of experiment; you can use the **docker cp** technique discussed in the tutorial. Alternatively you can do an **exec /usr/bin/tar ...** to stdout pipe this to a host file. Be aware that the container uses Alpine as its Linux OS, so **tar** is the simpler busybox version. Again, the tutorial explains how to log into a bash shell in the container. You use this to debug your tar command. You might also want to bracket the tar command with a **service nodered stop** and start.

BTW, (i) why are you exposing SNMP to the host ports? I am not sure why you'd do this. (ii) why use the "Europe/Amsterdam" TZ (other than this is the one referenced in the tutorial)?

---

<div class="post-metadata">

**Author:** ![AndKe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andke/32/73023_2.png) [@AndKe](https://discourse.nodered.org/u/AndKe)\
**Post date:** [25 November 2023 23:03 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188/3 "2023-11-25T23:03:59Z")

</div>

So, you are saying that with a proper docker-compose.yml , I can just make it use/run the current installation/data.  
i : I am using SNMP for UPS monitoring. (node-red-snmp-trap-listener)  
ii : I just kept "Europe/Amsterdam" because it works fine for me (being in UTC+1) - I guess you are implying I should just remove it? (use system setting?)

Thank you.

---

<div class="post-metadata">

**Author:** ![TerryE](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/terrye/32/65423_2.png) [@TerryE](https://discourse.nodered.org/u/TerryE)\
**Post date:** [25 November 2023 23:20 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188/4 "2023-11-25T23:20:42Z")

</div>

i. yes _but_ D-C has a naming convention that prefixes the reference volume name with the project, so a **docker volume ls** will list **myproject\_node-red-data** as well as **node-red-data** and so won't pick up the same volume by default. There are standard tricks for doing this move but these hints can be found on StackOverflow, not here. Or you could just do a backup and restore to move the content as discussed above. Also note the usual issue about nodered embedding the hostname in the flow filename by default.

ii. I hate using any timezone other than UTC for process control because of when daylight savings applies and when it doesn't. Working in UTC avoids all this, but if your project uses a Central Europe TZ and works fine then don't change.

---

<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:** [24 January 2024 23:21 UTC](https://discourse.nodered.org/t/please-help-me-moving-node-red-docker-to-docker-compose-retaining-data/83188/5 "2024-01-24T23:21:31Z")

</div>

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