category
category

Reputation: 2165

command substitution in docker CMD

Using:

CMD ["$(pipenv --venv)/bin/python3", "main.py", "/root/uploads"]

Causes an error on docker run:

Error response from daemon: invalid header field value "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"$(pipenv --venv)/bin/python3\\\": stat $(pipenv --venv)/bin/python3: no such file or directory\"\n"

Is there any way to make evaluate command substitutions like $(pipenv --venv)/bin/python3 in the CMD section?

Upvotes: 2

Views: 1075

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146620

Change it to below

CMD ["bash", "-c", "$(pipenv --venv)/bin/python3 main.py /root/uploads"]

If that still gives you issue, change $ to $$

Upvotes: 5

Related Questions