Import external library in docker

How can i import external modules using docker. With the local environment, i do have the option to use npm but with the default docker this is a different think.

What are best practices to install and allow external modules?
In this case for that module: Getting started | Ajv JSON schema validator

  1. Enable external modules using docker-compose: NODE_FUNCTION_ALLOW_EXTERNAL=ajv
  2. Build a custom dockerfile?

Hi @azngeek, yes you’d need to set the env variable as suspected and install the modules in your docker container. One possible way would be the use of a custom Dockerfile, n8n/docker/images/n8n-custom at master · n8n-io/n8n · GitHub has a template (without the npm install command, so you would need to add this before building your image).

1 Like

Perfect. This is what i need. I think this should also be linked to the documentation in the deployment-section. I guess for more advanced setups this will be requested more often.

It’s in the documentation in principle though slightly outdated I am afraid due to the recent changes to our Dockerfiles. I hope this changes sooon, but for the time being I think the repository is the best place to check on this.