I’m using n8n in a Docker setup on a Jelastic-based cloud host. Everything works fine, but I’m having trouble with data persistence. When I restart the container, all my workflows and login info disappear. I made a volume in my environment setup, like I did on my local machine where it works, but no luck here.
I’m okay with tech stuff, but this is a bit tricky for me. Can anyone help me figure out how to keep my n8n data safe when the container restarts? I’d really appreciate some advice on this!
Here’s what my current setup looks like:
Environment:
- Docker container
- n8n application
- Volume (not working as expected)
- Jelastic cloud host
Problem:
- Data loss on container restart
- Workflows and credentials not persisting
Goal:
- Maintain data across container restarts
- Ensure proper volume configuration
Hey there, I’ve been using n8n with Docker for a while now and had similar issues at first. Here’s what worked for me:
Make sure your Docker Compose file has the volumes section set up correctly. It should look something like this:
volumes:
/path/on/host:/data
Also, double-check that the n8n data directory inside the container is set to /data. You can do this by adding an environment variable:
environment:
N8N_DATA_FOLDER=/data
If that doesn’t work, try using a named volume instead of a bind mount. It’s often more reliable:
volumes:
n8n_data:/data
volumes:
n8n_data:
Lastly, ensure you’re not accidentally recreating the container each time you restart. Use ‘docker-compose up -d’ instead of ‘docker-compose up --force-recreate’.
Hope this helps! Let me know if you need any more details.
I’ve encountered similar issues with data persistence in Docker setups before. It sounds like your volume is not properly configured or mounted. You might want to verify that your Docker Compose file or run command specifies the volume path correctly, check the permissions on the host directory, and confirm that data is indeed being written to the volume. If these measures do not resolve the issue, consider inspecting the container logs for error messages regarding volume mounting and switching from a bind mount to a named volume. Additionally, ensure that your n8n configuration is set to use the correct data directory, as sometimes the application needs explicit direction for storing persistent data. I hope these suggestions help resolve the issue.