Reputation: 69
how can I use an ARG in the docker cmd command?
FROM python:3.6.8
ARG profile=production
ENV profile ${profile}
ENTRYPOINT [ "export SETTINGS=/opt/${profile}.cfg" ]
CMD [ "python", "-m" ,"acalls_clasiffier"]
This is the error that appears:
exec: "export SETTINGS=/opt/${profile}.cfg": stat export SETTINGS=/opt/${profile}.cfg: no such file or directory: unknown
Upvotes: 1
Views: 230
Reputation: 263627
There are multiple things wrong with this:
But the simple answer is to define an environment variable either as an ENV
in the Dockerfile or preferably as runtime settings in your compose file or Kubernetes manifest so you aren't injecting configuration into the image. Since you've only provided the Dockerfile, that looks like:
FROM python:3.6.8
ARG profile=production
ENV profile ${profile}
ENV SETTINGS /opt/${profile}.cfg
CMD [ "python", "-m" ,"acalls_clasiffier"]
Upvotes: 3