4

I have created a dockerized django app using docker-compose(following this tutorial). Now I want to add some packages to requirements.txt and install them. What is the right way to do that?

2 Answers 2

3

From the tutorial you point to - the statement

ADD requirements.txt /code/ copies requirements.txt file from your current directory on the host into /code/ directory inside the container. When docker-compose run command is executed, it first builds the container at which point it loads the 'requirements.txt' file into it.

So if you want to make changes to it, do it locally before you run compose. This will build and run your dockerized app with the new packages in your modified requirements.txt file.

1
  • 1
    ADD requirements.txt /code/ should be written in Dockerfile Commented Oct 18, 2017 at 16:16
-1

Go into your virtual environment. Your file name is requirements.txt

You need to type in the terminal

pip install -r requirements.txt

This should install all the packages listed in your requirements.txt

In case when some of your modules failed to install you have to manually install them.

1
  • I think the best would be if docker could install via pip on docker-compose run. Commented Jan 27, 2016 at 13:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.