Can fix Error: command /bin/sh not found in Portainer ( docker-compose)

Describe the problem/error/question

Starting from portioner a docker-compose n8n container and n8n worker can’t run . Message is Log Error: command /bin/sh not found

What is the error message (if any)?

Error: command /bin/sh not found

Please share your Docker-compose

version: '3.8'

volumes:
  db_storage:
  n8n_storage:

services:
  postgres:
    image: postgres:11
    restart: always
    environment:
      - POSTGRES_USER=my_postgres_user
      - POSTGRES_PASSWORD=my_postgres_password
      - POSTGRES_DB=my_n8n_db
      - POSTGRES_NON_ROOT_USER=my_n8n_user
      - POSTGRES_NON_ROOT_PASSWORD=my_n8n_password
    volumes:
      - db_storage:/var/lib/postgresql/data
      - ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}']
      interval: 5s
      timeout: 5s
      retries: 10
      networks:
        - default
  n8n:
    image: n8nio/n8n:latest
    command: worker

    restart: always
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=my_n8n_db
      - DB_POSTGRESDB_USER=my_n8n_user
      - DB_POSTGRESDB_PASSWORD=my_n8n_password
    ports:
      - 5678:5678
    volumes:
      - n8n_storage:/home/node/.n8n
    depends_on:
      postgres:
        condition: service_healthy

  n8n-worker:
    image: n8nio/n8n:latest
    command: worker
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_PORT=5432
      - DB_POSTGRESDB_DATABASE=my_n8n_db
      - DB_POSTGRESDB_USER=my_n8n_user
      - DB_POSTGRESDB_PASSWORD=my_n8n_password
    depends_on:
      postgres:
        condition: service_healthy

networks:
  default:
    driver: bridge

Information on your n8n setup

Hostname XXXXXX
OS Information linux x86_64 Ubuntu 22.04.2 LTS
Kernel Version 5.15.0-78-generic
Total CPU 24
Total memory 38.4 GB
Portainer 24.0.2 (API: 1.43)

Any help will be appreciate it, ( almost all day looking at it with no success ;). ) thanks in advance!

Same for me after upgrade to V1.
tried to downgrade but no luck.

Hey @Juan_Pablo_Sanchez,

Is it both the worker and main instance showing that message in Portainer? I would start by checking the user and workfing directory in the container settings and make sure they have changed from /data and root to /home/node and node. For some reason Portainer doesn’t automatically update this adn I suspect that could be part of your issue.

In your compose paste you are also using the worker command for both your n8n and n8n-worker instances which is a bit odd as well.

Thanks i can´t make it work . What i had done is to export the postgres ddbb and export worfklow_entity table . Do you know if there is a way to convert this CSV ( table export in csv) to a flow.json in order to import it to a new n8n? thanks again

Hey @Juan_Pablo_Sanchez,

There might be a way but I have not tried that before, I am not sure why you would export the data either the error looks to be unrelated to that.

You might be able to manually put the workflows together again but if it was me I would restore from a full database backup if you have one it will save you a lot of time.

thanks i just try to restore and comes with errores not sure why so this is why i was hooping to just upload de workflow_entity table . already test it and not working in terms of see it in N8n ( i upload it to the table with no error)

my volume is like this.
still having same error

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - n8n_data:/home/node/.n8n

@hismayilov what error are you seeing?

@Jon

Error: command /bin/sh not found

docker-compose file

Hey @hismayilov,

For your set up it is the command you are running, Replace /bin/sh -c "start --tunnel" with just "start --tunnel" and see if that works.

2 Likes

Thanks worked.

1 Like