How can I add curl to my n8n deployment on Railway using the official Docker image?
ndhassan
HOBBYOP

10 months ago

I’m running n8n on Railway using the official Docker image (n8nio/n8n).
In my workflow, I use the Shell Command node to run a command that depends on curl (to download a video and extract frames using ffmpeg).

However, I keep getting:

bash
Copy
Edit
/bin/sh: curl: not found
I tried adding NIXPACKS_PKGS=curl, but I now realize that doesn’t work with Docker images — only Nixpacks builds.

I understand I can create a new project with a custom Dockerfile that installs curl, but I’d love to know:

Is there a way to add curl to my existing n8n Railway deployment?

If not, is forking the Docker image and deploying it as a new service the only clean solution?(also how to do it)

Any tips to avoid disconnecting it from my existing workflows?

I don’t mind starting from a new database, just want to avoid unnecessary complexity if there's a better path.

Thanks a lot in advance! 🙏

Solved

34 Replies

ndhassan
HOBBYOP

10 months ago

0ee304c2-dee3-4a0c-af80-6b5224c62649


ndhassan
HOBBYOP

10 months ago

i talked with n8n and they said this is a Railway issue!


medim
MODERATOR

10 months ago

run apk add curl if you are ssh'ing into the container


ndhassan
HOBBYOP

10 months ago

1359912483376071000


ndhassan
HOBBYOP

10 months ago

Dockerfile must install curl (and other tools) at build time, not dynamically during workflow execution.


medim
MODERATOR

10 months ago

Create a Dockerfile with the following content:
```Dockerfile
FROM n8nio/n8n:latest

RUN apk --no-cache add curl

CMD ["n8n"]```

Try deploying it and tell me how this goes


ndhassan
HOBBYOP

10 months ago

okay so first i need to add this file to github
then i add it to the workflow right?


medim
MODERATOR

10 months ago

You create a Dockerfile in your github repo, then you deploy this repo in your project


medim
MODERATOR

10 months ago

You should also copy all env vars from your original service to this new service


ndhassan
HOBBYOP

10 months ago

like that?

1359914898712166700


medim
MODERATOR

10 months ago

yes.


medim
MODERATOR

10 months ago

let's see if it deploys fine


ndhassan
HOBBYOP

10 months ago

i got:
✕ [2/2] RUN apk --no-cache add curl
process "/bin/sh -c apk --no-cache add curl" did not complete successfully: exit code: 99

Dockerfile:3

1 | FROM n8nio/n8n:latest

2 |

3 | >>> RUN apk --no-cache add curl

4 |

5 | CMD ["n8n"]

ERROR: failed to solve: process "/bin/sh -c apk --no-cache add curl" did not complete successfully: exit code: 99


medim
MODERATOR

10 months ago

```Dockerfile
FROM n8nio/n8n:latest

RUN apk update && \
apk add --no-cache curl

CMD ["n8n"]```


medim
MODERATOR

10 months ago

try running update before


ndhassan
HOBBYOP

10 months ago

i got same error


ndhassan
HOBBYOP

10 months ago

i used:
FROM node:18-alpine

Set working directory

WORKDIR /app

Install dependencies

RUN apk update && apk add --no-cache \
curl \
python3 \
make \
g++ \
git \
bash

Install n8n globally

RUN npm install -g n8n

Create config dir

RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node

Run as non-root

USER node

EXPOSE 5678

CMD ["n8n"]


medim
MODERATOR

10 months ago

and did it work?


ndhassan
HOBBYOP

10 months ago

the nodes are connected with arrows now

1359919159437164800


ndhassan
HOBBYOP

10 months ago

but same problem Problem in node ‘Execute Command‘
Command failed: curl --version /bin/sh: curl: not found


medim
MODERATOR

10 months ago

That's just the reference from env vars, doesn't really means that it is working.


medim
MODERATOR

10 months ago

could u show the deploy logs from the Dockerfile service?


ndhassan
HOBBYOP

10 months ago

Starting Container

Initializing n8n process

n8n ready on ::, port 5678

n8n detected that some packages are missing. For more information, visit https://docs.n8n.io/integrations/community-nodes/troubleshooting/

n8n Task Broker ready on 127.0.0.1, port 5679

Registered runner "JS Task Runner" (ajoEMjhWzZourHwY_56hiU)

Version: 1.86.1

Editor is now accessible via:

https://primary-production-5a6b.up.railway.app


medim
MODERATOR

10 months ago

I think the issue is that this command is being run on the worker


medim
MODERATOR

10 months ago

And the worker isn't using this custom Dockerfile


ndhassan
HOBBYOP

10 months ago

yes if i wont to re deploy the worker, i see the new dockerfile active and not synced together


ndhassan
HOBBYOP

10 months ago

finally, i fixed it!!


ndhassan
HOBBYOP

10 months ago

i changed all the sources from n8n image to my repo

1359926533602541600


medim
MODERATOR

10 months ago

oh, amazing


medim
MODERATOR

10 months ago

glad you could do it!


medim
MODERATOR

10 months ago

gonna mark this as solved


ndhassan
HOBBYOP

10 months ago

thank you a lot!!!


medim
MODERATOR

10 months ago

np, sorry I couldn't be of much help! if you find another issue please open a new thread!


medim
MODERATOR

10 months ago

!s


Status changed to Solved medim 10 months ago


Loading...