Gaurav Ojha Gaurav Ojha - 1 year ago 101
Python Question

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 \

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

# copy all files to /app
COPY . /app

# change working directory to /app

# expose port

# run python
ENTRYPOINT ["python"]

# run app
CMD [""]
is a simple
project which also involves some scraping using
. I can successfully build and run
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/';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
builds fine on other systems!

Answer Source

I figured it out.

The problem was with a library -

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download