Search code examples
linuxwindowsdockerdockerfiledocker-build

Use linux commands in Docker file and build on windows


I am a beginner in Docker and I have a situation here. My docker file looks like this.

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. How can I build a docker specific to Linux, on windows?


Solution

  • you are on alpine , you should use apk not apt-get .

    apt-get is the package management for Debian baised systems.

    you can also change the base image then do not need to change any commands:

    FROM python:3.6-buster