# Unable to Create custom docker image of custom node-red core code

**URL:** <https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005>\
**Category:** Core Development\
**Created:** [17 April 2020 09:45 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005 "2020-04-17T09:45:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrey.garg](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shrey.garg](https://discourse.nodered.org/u/shrey.garg)\
**Post date:** [17 April 2020 09:45 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/1 "2020-04-17T09:45:20Z")

</div>

Hi,  
I forked node-red/node-red repository and made some custom changes to its UI and functionality. Now I want to create a docker image of this edited node-red source code. I found this [link](https://github.com/node-red/node-red-docker/tree/master/docker-custom) regarding the customer docker image creation. But it mentions that it picks node-red code from npm registry.  
How do I make custom docker image of a local node-red source code ?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 April 2020 09:50 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/2 "2020-04-17T09:50:34Z")

</div>

the node-red version is a dependency in the package.json there - so edit that to point that at your local version instead.

---

<div class="post-metadata">

**Author:** ![shrey.garg](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shrey.garg](https://discourse.nodered.org/u/shrey.garg)\
**Post date:** [17 April 2020 10:09 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/3 "2020-04-17T10:09:38Z")

</div>

I tried doing that. Image gets built But when I run the image using `docker run -it -p 1880:1880 --name <name> <image>` that didn't work. It said Module Not Found error.

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/d/3dd501301762355e592b46fd2437060bbfd39b30.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [17 April 2020 10:57 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/4 "2020-04-17T10:57:45Z")

</div>

What exactly did you put in the package.json file?

---

<div class="post-metadata">

**Author:** ![shrey.garg](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@shrey.garg](https://discourse.nodered.org/u/shrey.garg)\
**Post date:** [20 April 2020 15:47 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/6 "2020-04-20T15:47:59Z")

</div>

This is the package.json file for docker-custom

```auto
{
    "name": "node-red-docker",
    "version": "1.0.5",
    "description": "Low-code programming for event-driven applications",
    "homepage": "http://nodered.org",
    "license": "Apache-2.0",
    "main": "node_modules/node-red/red/red.js",
    "scripts": {
        "start": "node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS"
    },
    "contributors": [],
    "dependencies": {
        "node-red": "file:../node-red"
    },
    "engines": {
        "node": ">=10"
    }
}

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [20 April 2020 16:14 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/7 "2020-04-20T16:14:32Z")

</div>

Hi @shrey.garg

I've edited your post to make the JSON a bit more readable.

I don't have a quick answer here - this isn't something I've thought about or done before.

The node-red git repository contains 7 separate npm modules that make up Node-RED. You can't simply point to the root of the git repository because that is not the same thing as the `node-red` module published to npm.

There may be an easier way to do it, but I would try something along the lines of:

1. run `grunt release` to build the npm module tgz files. These get written to `.dist/modules/`.
2. modify your `package.json` file to point to these tgz files:

```auto
    "dependencies": {
        "@node-red/util": "file:../node-red/.dist/modules/node-red-util-x.y.z.tgz",
        "@node-red/runtime": "file:../node-red/.dist/modules/node-red-runtime-x.y.z.tgz",
        "@node-red/registry": "file:../node-red/.dist/modules/node-red-registry-x.y.z.tgz",
        "@node-red/nodes": "file:../node-red/.dist/modules/node-red-nodes-x.y.z.tgz",
        "@node-red/editor-client": "file:../node-red/.dist/modules/node-red-editor-client-x.y.z.tgz",
        "@node-red/editor-api": "file:../node-red/.dist/modules/node-red-editor-api-x.y.z.tgz",
        "node-red": "file:../node-red/.dist/modules/node-red-x.y.z.tgz"
    },

```

You will need to change `x.y.z` for whatever version number you've given your custom modules. (Use the command `node scripts/set-package-version.js x.y.z` to update all of the module's package.json files with the version number of your choosing _before_ running `grunt release`).

That should then install the modules from your customised version. But as I said... I haven't tried this, so not sure if there's anything else needed.

---

<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:** [19 June 2020 16:14 UTC](https://discourse.nodered.org/t/unable-to-create-custom-docker-image-of-custom-node-red-core-code/25005/8 "2020-06-19T16:14:38Z")

</div>

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