Dockerfile, cannot add text file and getting error


I am totally stuck !

My dockerfile …

FROM  nodered/node-red:3.1.3

RUN mkdir -p /data/gb/test

WORKDIR /data/gb/test

COPY test.txt /data/gb/test

This does create the folders in Node-RED /data folder.

But when I type into CLI … docker compose up -d … I get this error ?

Error response from daemon: 
failed to create task for container: failed to create shim task: 
OCI runtime create failed: runc create failed: unable to start container process: 
exec: "./": stat ./ no such file or directory: unknown

The code below does work and creates the text file in that dir, but I cannot get it into /data ?

WORKDIR /usr/src/node-red
COPY test.txt .


The error message caused by the WORKDIR instruction in your Dockerfile, which prevents the ENTRYPOINT command it inherited from the base image, to find the file in the current WORKDIR.

I am not really sure what this sentence is supposed to mean, but I guess you want to copy test.txt into the /data folder:

COPY test.txt /data/test.txt


Yes the test.txt is just to see if I can get a very simple thing into the folder as a test.

Anyway I can solve this or is the ENTRYPOINT command always going to stop it ?


So you tried what I suggested and came up with that conclusion?


The entrypoint is already set in the Node-RED image
I am using Running under Docker : Node-RED

So i do not think i can change that.


You know the cause that made the entrypoint fail. You need to eliminate the cause, or change the reference to the entrypoint. Even if you think you can’t change the entrypoint, the other option is still there. You can reset the workdir. Or change the path of the entrypoint using the instruction that @meyay gave you. By the way, you can always change everything. Even the entrypoint or command. The base image is just a base.

Can you help me with some code how to change the entrypoint and workdir?

The image is nodered/node-red:3.1.3


You could very easily search for the keyword on Google and find lots of examples and the documentation, but I can share my blogpost which shows a lot about what you need to know.

Thanks will look at it and learn :+1: