Error when building image

Hi all,

I’m new to Docker and I have an Linux x86-64 image on Docker Hub that I would like to install on my arm64(aarch64) NAS.

I’ve downloaded the image to the NAS using git clone just fine and I’m trying to build it using the command

docker build \
  --no-cache \
  --pull \
  -t rmountjoy/dashmount0.7:latest .

During Step 5 I get this error:

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.8
      copying pysassc.py -> build/lib.linux-aarch64-3.8
      copying sass.py -> build/lib.linux-aarch64-3.8
      copying sassc.py -> build/lib.linux-aarch64-3.8
      copying sasstests.py -> build/lib.linux-aarch64-3.8
      creating build/lib.linux-aarch64-3.8/sassutils
      copying sassutils/__init__.py -> build/lib.linux-aarch64-3.8/sassutils
      copying sassutils/_compat.py -> build/lib.linux-aarch64-3.8/sassutils
      copying sassutils/builder.py -> build/lib.linux-aarch64-3.8/sassutils
      copying sassutils/distutils.py -> build/lib.linux-aarch64-3.8/sassutils
      copying sassutils/wsgi.py -> build/lib.linux-aarch64-3.8/sassutils
      running build_ext
      building '_sass' extension
      creating build/temp.linux-aarch64-3.8
      creating build/temp.linux-aarch64-3.8/libsass
      creating build/temp.linux-aarch64-3.8/libsass/src
      creating build/temp.linux-aarch64-3.8/libsass/src/memory
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPy_LIMITED_API -I./libsass/include -I/usr/local/include/python3.8 -c _sass.c -o build/temp.linux-aarch64-3.8/_sass.o -fPIC -std=gnu++0x -Wall -Wno-parentheses -Werror=switch -DLIBSASS_VERSION="3.6.5"
      unable to execute 'gcc': No such file or directory
      error: command 'gcc' failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for libsass

Problem seems to be related to gcc, however this is installed.

# gcc --version
gcc (OpenWrt GCC 7.4.0) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If anyone can offer any suggestions it would be appreciated.

TIA

Appearently neither the base image provides gcc, not does it get installed in any of the RUN instructions in the Dockerfile. Everything required to build the image must be (made) available in it.

Either you need to add the missing bits and pieces yourself to the Dockerfile or raise an issue in the maintainers github repo. It’s always the same with automated things (and building an image from a Dockerfile is nothing else): eventualy things break → catching up with changes in the world is inevitable.

Thanks for your reply it’s appreciated.

If I add gcc to the Dockerfile like below is that correct?

FROM python:3.8-slim

RUN apt-get update -q \
  && apt-get install --no-install-recommends -qy \
  gcc \                                    <------------- Line Added
    inetutils-ping \
  && rm -rf /var/lib/apt/lists/*

COPY [ "requirements.txt", "/DashMachine/" ]

WORKDIR /DashMachine

RUN pip install --no-cache-dir --progress-bar off gunicorn
RUN pip install --no-cache-dir --progress-bar off -r requirements.txt

COPY [".", "/DashMachine/"]

ENV PRODUCTION=true

EXPOSE 5000
VOLUME /DashMachine/config

RUN chown -R 1000 /DashMachine/config
RUN chmod -R 775 /DashMachine/config
RUN chmod -R g+s /DashMachine/config

CMD [ "gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app" ]

The position is fine.
Though, I can not tell if it requires something else.

Did you try to build the image?

Yes, had to have:
python3-dev , g++ and gcc.

Took just over an hour to run, but all worked without errors.

Many thanks :slight_smile:

I reordered your Dockerfile to optimize for a smaller image size:

FROM python:3.8-slim

COPY [ "requirements.txt", "/DashMachine/" ]
WORKDIR /DashMachine

RUN apt-get update -q \
  && apt-get install --no-install-recommends -qy python3-dev g++ gcc inetutils-ping \
  && pip install --no-cache-dir --progress-bar off gunicorn \
  && pip install --no-cache-dir --progress-bar off -r requirements.txt \
  && apt-get remove -qy python3-dev g++ gcc --purge \
  && rm -rf /var/lib/apt/lists/* 

COPY [".", "/DashMachine/"]

ENV PRODUCTION=true

EXPOSE 5000
VOLUME /DashMachine/config

RUN chown -R 1000 /DashMachine/config \
    && chmod -R 775 /DashMachine/config \
    && chmod -R g+s /DashMachine/config

CMD [ "gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app" ]

N.B.:

  • your chmod and chown might not have the effect you expect… as soon as you use a bind-mount not only will the folder content be replaced by the source, but also the ownership and permissions.
  • Usualy a dockerfile can be optimized for readability (what you did) or minmal size (what I did). Each RUN instruction will create a new layer, even for small changes like chmod and chown.

Thank you, will try it out.

BTW - Can you tell me what the -qy does on the apt-get line?

TIA

y = assume yes
q = verbose (I am not entirely sure of this one though)

Usualy I only use -y, this time I copied -qy from the apt-get installl command.

Thanks once again.

Greg