在 Docker 文件中使用 linux 命令并在 windows 上构建
Use linux commands in Docker file and build on windows
我是 Docker 的初学者,我在这里遇到了一些情况。
我的 docker 文件如下所示。
FROM python:3.6-alpine
#Copy contents
COPY . /srv/flask_app
WORKDIR /srv/flask_app
#Get essentials to base image
RUN apt-get clean \
&& apt-get -y update
RUN apt-get -y install nginx \
&& apt-get -y install python3-dev \
&& apt-get -y install build-essential
RUN pip install -r requirements.txt --src /usr/local/src
COPY nginx.conf /etc/nginx
RUN chmod +x ./start.sh
CMD ["./start.sh"]
当我试图在 windows 上构建 docker 文件时,它给我一个错误,提示找不到 Linux 命令。如何在 windows 上构建特定于 Linux 的 docker?
你在 alpine
,你应该使用 apk
而不是 apt-get
。
apt-get
是 Debian
基本系统的包管理。
您也可以更改基本映像,然后不需要更改任何命令:
FROM python:3.6-buster
我是 Docker 的初学者,我在这里遇到了一些情况。 我的 docker 文件如下所示。
FROM python:3.6-alpine
#Copy contents
COPY . /srv/flask_app
WORKDIR /srv/flask_app
#Get essentials to base image
RUN apt-get clean \
&& apt-get -y update
RUN apt-get -y install nginx \
&& apt-get -y install python3-dev \
&& apt-get -y install build-essential
RUN pip install -r requirements.txt --src /usr/local/src
COPY nginx.conf /etc/nginx
RUN chmod +x ./start.sh
CMD ["./start.sh"]
当我试图在 windows 上构建 docker 文件时,它给我一个错误,提示找不到 Linux 命令。如何在 windows 上构建特定于 Linux 的 docker?
你在 alpine
,你应该使用 apk
而不是 apt-get
。
apt-get
是 Debian
基本系统的包管理。
您也可以更改基本映像,然后不需要更改任何命令:
FROM python:3.6-buster