0

I have been struggling to add env variables into my container for the past 3 hrs :( I have looked through the docker run docs but haven't managed to get it to work.

I have built my image using docker build -t sellers_json_analysis . which works fine.

I then go to run it with: docker run -d --env-file ./env sellers_json_analysis

As per the docs: $ docker run --env-file ./env.list ubuntu bash but I get the following error:

docker: open ./env: no such file or directory.

The .env file is in my root directory

But when running docker run --help I am unable to find anything about env variables, but it doesn't provide the following:

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

So not sure I am placing things incorrectly. I could add my variables into the dockerfile but I want to keep it as a public repo as it's a project I would like to display.

1 Answer 1

2

Your problem is wrong path, either use .env or ./.env, when you use ./env it mean a file named env in current directory

docker run -d --env-file .env sellers_json_analysis
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.