Unable to Install Python3 using docker compose file

Hi team,

Am trying to install python3 and i have included [ command: /bin/sh -c “apk add --update python3 py3-pip”
command: /bin/sh -c “sleep 5; n8n start”] on my docker-compose file
But the version on python is not getting installed

Docker compose file for your Reference

version: '3.4'


    image: n8nio/n8n
    restart: always
      - DB_TYPE=mysqldb
      - DB_MYSQLDB_HOST=**********
      - DB_MYSQLDB_PORT=****
      - DB_MYSQLDB_USER=****
      - DB_MYSQLDB_PASSWORD=******
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - 5678:5678
    # Wait 5 seconds to start n8n to make sure that PostgreSQL is ready
    # when n8n tries to connect to it
    command: /bin/sh -c "apk add --update python3 py3-pip"
    command: /bin/sh -c "sleep 5; n8n start"

I have not tried installing python3 in Alpine before but are you running the Python command or Python3?

Hi @Vaithiyanathan_S,

From looking at the docker compose docs, I am not sure two command options would work. From looking at the result I reckon that’s not the case but I am not overly familiar with docker compose. Docker itself only accepts the last CMD.

So my suggestion would be to use the Dockerfile provided in Running Python with n8n - #3 by jan. In your docker compose file you then replace image: n8nio/n8n with build: . (assuming Dockerfile and docker compose file are in the same directory) and get rid of both command options. I’ve just tried running docker compose up --force-recreate --build with this config and can now use python3 as expected:

Hope this helps!