How would I achieve the following in a Dockerfile:
sudo python
import nltk
nltk.download('all')
You can build a custom Docker image with everything you need:
FROM python:3.6-slim
RUN pip3 install nltk
RUN [ "python", "-c", "import nltk; nltk.download('all')" ]
ENTRYPOINT python
Then build:
docker build -t docker-nltk .
And run:
docker run -it docker-nltk
If you add your code to the file downloadall.py this Dockerfile does the job on my machine:
FROM python:3
RUN pip install nltk
ADD downloadall.py /
CMD [ "python", "./downloadall.py" ]
Let me know if it works for you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With