Inside my Dockerfile:
ENV PROJECTNAME mytestwebsite
CMD [\"django-admin\", \"startproject\", \"$PROJECTNAME\"]
Error:
Comma
When you use an execution list, as in...
CMD ["django-admin", "startproject", "$PROJECTNAME"]
...then Docker will execute the given command directly, without involving a shell. Since there is no shell involved, that means:
>
, <
, |
, etccommand1; command2
If you want your CMD
to expand variables, you need to arrange for a shell. You can do that like this:
CMD ["sh", "-c", "django-admin startproject $PROJECTNAME"]
Or you can use a simple string instead of an execution list, which gets you a result largely identical to the previous example:
CMD django-admin startproject $PROJECTNAME