问题描述
如何使这些dockerfile命令在Windows10上运行?我正在构建docker映像-我需要用Windows兼容的程序包管理器替换“ apt-get”吗?
FROM python:3.6.5
RUN mkdir -p ./voice_flask/d
workdir /voice_flask/d
copY . /voice_flask/d
# RUN pip3 install llvmlite==0.31.0
RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" >> /voice_flask/d/sources.list
RUN echo "deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" >> /voice_flask/d/sources.list
RUN apt-get install -y --no-install-recommends libedit-dev build-essential
RUN apt-get install -y --no-install-recommends llvm-8 llvm-8-dev
RUN LLVM_CONfig=/usr/bin/llvm-config-8 pip3 install enum34 llvmlite numba
#RUN pip install -r requirements.txt
CMD ["python","server.py"]
解决方法
在最新的Ubuntu上,llvmlite和numba直接通过pip3安装。
这是一个示例Dockerfile
FROM ubuntu:latest
RUN apt-get update && apt-get -y install python3-pip
RUN pip3 install enum34 llvmlite numba
CMD ["/bin/echo","hello world"]
内部版本:docker build . -t llvm_docker
运行:docker run -t llvm_docker
输出:hello world
您可以使用官方图像作为父图像。例如,您可以使用ubuntu映像ubuntu:latest
执行上述命令。然后我想它看起来像下面的代码:
FROM ubuntu:latest
RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" >> /etc/apt/sources.list
RUN echo "deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" >> /etc/apt/sources.list
RUN apt-get install -y --no-install-recommends libedit-dev build-essential
RUN apt-get install -y --no-install-recommends llvm-8 llvm-8-dev
RUN LLVM_CONFIG=/usr/bin/llvm-config-8 pip3 install enum34 llvmlite numba
也许对您有用first simple example dockerfile:
FROM ubuntu:latest
CMD ["/bin/echo","hello world"]