如何创建在Ubuntu容器中安装Python 3和NLTK的Dockerfile



我正在尝试使用Python 3和NLTK Tokenizer创建一个Docker容器。任何人都可以帮助我创建Dockerfile。

这是一个Dockerfile,它通过python3-nltk Debian软件包安装nltk(并证明它确实有效(

FROM ubuntu:xenial
RUN apt-get update && 
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends 
        python3-nltk && 
    rm -rf /var/lib/apt/lists/*
CMD ["python3", "-c", "import nltk"]

请注意,在Dockerfile最佳实践中建议使用apt-get样板

您可以这样开始您的Dockerfile:

FROM python:3-wheezy
RUN apt-get update && apt-get install -y git ca-certificates
RUN pip install -q nltk
#optionally your other docker commands here

然后构建并运行容器。

obs:如果您喜欢纯Ubuntu容器替换为" python:3-Wheezy",则这是一个基于Debian的官方容器(与Ubuntu兼容(,用" Dominga/uwsgi-python3"替换为ubuntu14

/div>

最新更新