Search code examples
pythonwindowsubuntudockercapybara-webkit

Dockerfile not able to build on Ubuntu 14.04 but does fine on Windows 10 and Ubuntu 16.04


I have the following Dockerfile -

FROM ubuntu:16.04

RUN apt-get update -y && apt-get install -y \
    python-pip \
    python-dev \
    python-lxml \
    build-essential \
    qt5-default \
    libqt5webkit5-dev \
    xvfb \
    git

RUN pip install --upgrade pip && pip install \
    lxml \
    xvfbwrapper \
    flask \
    bs4 \
    dryscrape

# copy all files to /app
COPY . /app

# change working directory to /app
WORKDIR /app

# expose port
EXPOSE 5000

# run python
ENTRYPOINT ["python"]

# run app
CMD ["myapp.py"]

myapp.py is a simple flask project which also involves some scraping using dryscrape. I can successfully build and run myapp from these on my Windows 10 and Ubuntu 16.04 machines. On my DigitalOcean droplet running Ubuntu 14.04 I get the following error and the build doesn't get completed -

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-dUcM4q/webkit-server/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-k2iocl-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-dUcM4q/webkit-server/

Also, it says - No such file or directory src/webkit_server even when I try to install it without docker. The issue could possibly be with webkit-server but how come docker doesn't manage to run it consistently on different systems?

Its not as if there's a problem with docker because I'm successfully running several test projects in golang, node.js, etc. on the same server using Docker.

I don't understand the issue or the reason why it appears because the same Dockerfile builds fine on other systems!


Solution

  • I figured it out.

    The problem was with a library - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=788282

    For some reason, this particular library which is involved in one of the dependencies of the build, doesn't go well on a 64-bit linux. Either its 32-bit version has to be explicitly installed or a 32-bit base image must be used.

    For simplicity, change the first line of the Dockerfile to -

    FROM 32bit/ubuntu:16.04