come eseguire apt-get in Windows nel file Docker?

Aug 24 2020

Come eseguire questi comandi dockerfile su Windows10? Sto costruendo la mia immagine docker: devo sostituire 'apt-get' con un gestore di pacchetti compatibile con Windows?

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"]

Risposte

2 skybunk Aug 24 2020 at 13:51

Sull'ultimo Ubuntu, llvmlite e numba si installano direttamente con pip3.

Ecco un esempio di 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"]

Costruire: docker build . -t llvm_docker

Correre: docker run -t llvm_docker

Produzione: hello world

1 flaxel Aug 24 2020 at 10:59

Puoi utilizzare un'immagine ufficiale come immagine principale. Ad esempio, puoi utilizzare l'immagine ubuntu ubuntu:latestper eseguire i comandi sopra. Quindi immagino che assomigli al seguente codice:

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

Forse è utile per te fare un primo semplice file docker di esempio :

FROM ubuntu:latest

CMD ["/bin/echo", "hello world"]