[ERROR] No such file or directory. Can't run workflow

Hi, I’m stuck on how to deploy my workflow. Any help is welcome

The issue

My goal is to import a cron workflow inside a docker container. At the moment the container is created by docker-compose, the workflow should start running. However, when run docker-compose up n8n (n8n as my service name), it throws the following error and abort container execution with exit code 0.

Error message:

[[email protected] platform]# docker-compose up n8n
Recreating platform_n8n_1
Attaching to platform_n8n_1
n8n_1 | su-exec: n8n update:workflow --all --active=true: No such file or directory
platform_n8n_1 exited with code 0

When I build the docker container, “Successfully imported 1 workflow.” message is shown, which is expected. But I don’t get what is this missing file or directory when executing workflow

Current setup

Dockerfile
# set base image
FROM n8nio/n8n

# define working directory
WORKDIR /etc/n8n

# copy workflows
COPY ./ ./

# import workflows from folder
RUN n8n import:workflow --separate --input=./workflows
docker-compose.yml
n8n:
  image: [builded-image-here]
  volumes:
    - ./data/n8n/.n8n:/home/node/.n8n
    - /var/run/docker.sock:/var/run/docker.sock
  ports:
    - "5678:5678"
  command:
    - n8n update:workflow --all --active=true
  environment:
    - DB_TYPE=postgresdb
    - DB_POSTGRESDB_DATABASE=*****
    - DB_POSTGRESDB_HOST=*****
    - DB_POSTGRESDB_PORT=5432
    - DB_POSTGRESDB_USER=*****
    - DB_POSTGRESDB_SCHEMA=public
    - DB_POSTGRESDB_PASSWORD=*****
    - DB_TABLE_PREFIX=n8n_
    - MYSQL_DATABASE=*****
    - MYSQL_HOST=*****
    - MYSQL_PORT=3306
    - MYSQL_USER=*****
    - MYSQL_PASSWORD=*****
    - N8N_ENCRYPTION_KEY=*****************
  restart: always

Information on your n8n setup

Info
  • n8n version: [email protected]
  • Database: Postgres, but using a MySql node
  • Running n8n via: Docker

Hi @Leonardo_Almeida_Rei, n8n provides a Dockerfile allowing you to build a custom image here: n8n/docker/images/n8n-custom at master · n8n-io/n8n (github.com). Perhaps you can give that a go? Or alternatively use one of the pre-built docker images?

Thanks for replying @MutedJam :slight_smile: How can I import and start a pre-build workflow, with this custom image without using its UI?
My goal it’s to automatically start my workflow whenever container is started up by docker-compose.yml, without my user having to manually do so

Hey @Leonardo_Almeida_Rei, you can still add additional commands to the Dockerfile or the docker entrypoint script as needed. Just make sure to run them as user node, as that’s the user executing n8n.