简体   繁体   English

在 Docker 文件中使用 linux 命令并在 windows 上构建

[英]Use linux commands in Docker file and build on windows

I am a beginner in Docker and I have a situation here.我是 Docker 的初学者,我这里有一个情况。 My docker file looks like this.我的 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"]

When I am trying to build the docker file on windows, it is giving me an error saying the Linux command can't be found.当我尝试在 windows 上构建 docker 文件时,它给了我一个错误,提示找不到 Linux 命令。 How can I build a docker specific to Linux, on windows?如何在 windows 上构建特定于 Linux 的 docker?

you are on alpine , you should use apk not apt-get .你在alpine上,你应该使用apk而不是apt-get

apt-get is the package management for Debian baised systems. apt-getDebian基础系统的 package 管理。

you can also change the base image then do not need to change any commands:您还可以更改基本映像,然后不需要更改任何命令:

FROM python:3.6-buster

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM