dockerCommand with multiple commands fails, why?

I am trying to deploy my dockerized Django app on render.

In my render.yaml I have the following line that is causing me trouble:
dockerCommand: "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn config.wsgi"

It causes the following error log: manage.py migrate: error: unrecognized arguments: manage.py collectstatic && gunicorn config.wsgi

I do not understand why this is the case. To be more precise: Why is the && not recognized properly as a command separator? Instead it is ignored and the other two commands are misinterpreted as arguments for the first command?

Any help is highly appreciated

For context, my complete render.yaml file looks as follows:

databases:
  - name: fingarden-backend-test1-db
    plan: free
    region: frankfurt

services:
  - type: web
    name: fingarden-backend-test1
    runtime: docker
    plan: free
    region: frankfurt
    dockerfilePath: Dockerfile
    dockerCommand: "python manage.py migrate && python manage.py collectstatic --noinput && gunicorn config.wsgi"

    envVars:
      - key: DATABASE_URL
        fromDatabase:
          name: fingarden-backend-test1-db
          property: connectionString

Docker command and argument parsing is pretty annoying, since it has both single string (“shell form”) and multiple parameters (“exec form”) modes, but multiple parameters assumes one base command and arguments to it ( Dockerfile reference | Docker Docs ). I thought single string mode didn’t have that same drawback but this error is suggesting otherwise.

Do you have the same CMD line in your Dockerfile? You only have to specify dockerCommand to override it. Have you tried this without specifying dockerCommand and letting the CMD execution happen instead.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.