1

I recently switched to Alpine Linux for my docker images, and Alpine doesn't have uwsgi-python3 plugin at the moment. Thus, I compile uwsgi during the container build with pip3 install uwsgi.

For some reason, this fails every now and then without any apparent pattern. I just repeated this on a minimal Dockerfile:

FROM alpine:3.4

RUN apk add --no-cache \
    gcc \
    linux-headers \
    musl-dev \
    python3 \
    python3-dev

RUN pip3 install --upgrade pip setuptools

RUN pip3 install uwsgi

When I run docker build --no-cache ., sometimes this Dockerfile builds fine:

$ docker build --no-cache .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM alpine:3.4
 ---> 4e38e38c8ce0
Step 2 : RUN apk add --no-cache     gcc     linux-headers   musl-dev    python3     python3-dev
 ---> Running in 8667f0d6c970
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/27) Installing binutils-libs (2.26-r0)
(2/27) Installing binutils (2.26-r0)
(3/27) Installing gmp (6.1.0-r0)
(4/27) Installing isl (0.14.1-r0)
(5/27) Installing libgomp (5.3.0-r0)
(6/27) Installing libatomic (5.3.0-r0)
(7/27) Installing libgcc (5.3.0-r0)
(8/27) Installing pkgconf (0.9.12-r0)
(9/27) Installing pkgconfig (0.25-r1)
(10/27) Installing mpfr3 (3.1.2-r0)
(11/27) Installing mpc1 (1.0.3-r0)
(12/27) Installing libstdc++ (5.3.0-r0)
(13/27) Installing gcc (5.3.0-r0)
(14/27) Installing linux-headers (4.4.6-r1)
(15/27) Installing musl-dev (1.1.14-r10)
(16/27) Installing libbz2 (1.0.6-r4)
(17/27) Installing expat (2.1.1-r1)
(18/27) Installing libffi (3.2.1-r2)
(19/27) Installing gdbm (1.11-r1)
(20/27) Installing xz-libs (5.2.2-r1)
(21/27) Installing ncurses-terminfo-base (6.0-r7)
(22/27) Installing ncurses-terminfo (6.0-r7)
(23/27) Installing ncurses-libs (6.0-r7)
(24/27) Installing readline (6.3.008-r4)
(25/27) Installing sqlite-libs (3.13.0-r0)
(26/27) Installing python3 (3.5.1-r3)
(27/27) Installing python3-dev (3.5.1-r3)
Executing busybox-1.24.2-r9.trigger
OK: 175 MiB in 38 packages
 ---> 7ccbdeeab3ae
Removing intermediate container 8667f0d6c970
Step 3 : RUN pip3 install --upgrade pip setuptools
 ---> Running in 319ca3341483
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
Collecting setuptools
  Downloading setuptools-24.0.3-py2.py3-none-any.whl (441kB)
Installing collected packages: pip, setuptools
  Found existing installation: pip 7.1.2
    Uninstalling pip-7.1.2:
      Successfully uninstalled pip-7.1.2
  Found existing installation: setuptools 18.2
    Uninstalling setuptools-18.2:
      Successfully uninstalled setuptools-18.2
Successfully installed pip-8.1.2 setuptools-24.0.3
 ---> 01bd82afce3d
Removing intermediate container 319ca3341483
Step 4 : RUN pip3 install uwsgi
 ---> Running in 6ca045b9c833
Collecting uwsgi
  Downloading uwsgi-2.0.13.1.tar.gz (784kB)
Installing collected packages: uwsgi
  Running setup.py install for uwsgi: started
    Running setup.py install for uwsgi: finished with status 'done'
Successfully installed uwsgi-2.0.13.1
 ---> 7c46cf5ed333
Removing intermediate container 6ca045b9c833
Successfully built 7c46cf5ed333

and sometimes not:

$ docker build --no-cache .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM alpine:3.4
 ---> 4e38e38c8ce0
Step 2 : RUN apk add --no-cache     gcc     linux-headers   musl-dev    python3     python3-dev
 ---> Running in 264d32d8d765
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/27) Installing binutils-libs (2.26-r0)
(2/27) Installing binutils (2.26-r0)
(3/27) Installing gmp (6.1.0-r0)
(4/27) Installing isl (0.14.1-r0)
(5/27) Installing libgomp (5.3.0-r0)
(6/27) Installing libatomic (5.3.0-r0)
(7/27) Installing libgcc (5.3.0-r0)
(8/27) Installing pkgconf (0.9.12-r0)
(9/27) Installing pkgconfig (0.25-r1)
(10/27) Installing mpfr3 (3.1.2-r0)
(11/27) Installing mpc1 (1.0.3-r0)
(12/27) Installing libstdc++ (5.3.0-r0)
(13/27) Installing gcc (5.3.0-r0)
(14/27) Installing linux-headers (4.4.6-r1)
(15/27) Installing musl-dev (1.1.14-r10)
(16/27) Installing libbz2 (1.0.6-r4)
(17/27) Installing expat (2.1.1-r1)
(18/27) Installing libffi (3.2.1-r2)
(19/27) Installing gdbm (1.11-r1)
(20/27) Installing xz-libs (5.2.2-r1)
(21/27) Installing ncurses-terminfo-base (6.0-r7)
(22/27) Installing ncurses-terminfo (6.0-r7)
(23/27) Installing ncurses-libs (6.0-r7)
(24/27) Installing readline (6.3.008-r4)
(25/27) Installing sqlite-libs (3.13.0-r0)
(26/27) Installing python3 (3.5.1-r3)
(27/27) Installing python3-dev (3.5.1-r3)
Executing busybox-1.24.2-r9.trigger
OK: 175 MiB in 38 packages
 ---> b7d316f0ff9d
Removing intermediate container 264d32d8d765
Step 3 : RUN pip3 install --upgrade pip setuptools
 ---> Running in beba565f5d1c
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
Collecting setuptools
  Downloading setuptools-24.0.3-py2.py3-none-any.whl (441kB)
Installing collected packages: pip, setuptools
  Found existing installation: pip 7.1.2
    Uninstalling pip-7.1.2:
      Successfully uninstalled pip-7.1.2
  Found existing installation: setuptools 18.2
    Uninstalling setuptools-18.2:
      Successfully uninstalled setuptools-18.2
Successfully installed pip-8.1.2 setuptools-24.0.3
 ---> 9402ed04a075
Removing intermediate container beba565f5d1c
Step 4 : RUN pip3 install uwsgi
 ---> Running in ba0b8d67469d
Collecting uwsgi
  Downloading uwsgi-2.0.13.1.tar.gz (784kB)
Installing collected packages: uwsgi
  Running setup.py install for uwsgi: started
    Running setup.py install for uwsgi: finished with status 'error'
    Complete output from command /usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8te7tuuc/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9e91dasm-record/install-record.txt --single-version-externally-managed --compile:
    running install
    using profile: buildconf/default.ini
    detected include path: ['/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
    Patching "bin_name" to properly install_scripts dir
    detected CPU cores: 2
    configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION="\"2.0.13.1\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="13" -DUWSGI_VERSION_REVISION="1" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"
    *** uWSGI compiling server core ***
    [thread 1][gcc] core/utils.o
    [thread 0][gcc] core/protocol.o
    [thread 0][gcc] core/socket.o
    [thread 0][gcc] core/logging.o
    [thread 1][gcc] core/master.o
    [thread 0][gcc] core/master_utils.o
    [thread 1][gcc] core/emperor.o
    [thread 0][gcc] core/notify.o
    [thread 0][gcc] core/mule.o
    [thread 0][gcc] core/subscription.o
    [thread 1][gcc] core/stats.o
    [thread 1][gcc] core/sendfile.o
    [thread 0][gcc] core/async.o
    [thread 1][gcc] core/master_checks.o
    [thread 0][gcc] core/fifo.o
    [thread 1][gcc] core/offload.o
    [thread 0][gcc] core/io.o
    [thread 1][gcc] core/static.o
    [thread 1][gcc] core/websockets.o
    [thread 0][gcc] core/spooler.o
    [thread 1][gcc] core/snmp.o
    [thread 1][gcc] core/exceptions.o
    [thread 0][gcc] core/config.o
    [thread 1][gcc] core/setup_utils.o
    [thread 1][gcc] core/clock.o
    [thread 0][gcc] core/init.o
    [thread 1][gcc] core/buffer.o
    [thread 0][gcc] core/reader.o
    [thread 1][gcc] core/writer.o
    [thread 0][gcc] core/alarm.o
    [thread 1][gcc] core/cron.o
    [thread 0][gcc] core/hooks.o
    [thread 1][gcc] core/plugins.o
    [thread 1][gcc] core/lock.o
    [thread 0][gcc] core/cache.o
    [thread 1][gcc] core/daemons.o
    [thread 1][gcc] core/errors.o
    [thread 1][gcc] core/hash.o
    [thread 1][gcc] core/master_events.o
    [thread 1][gcc] core/chunked.o
    [thread 0][gcc] core/queue.o
    [thread 1][gcc] core/event.o
    [thread 0][gcc] core/signal.o
    [thread 1][gcc] core/strings.o
    [thread 0][gcc] core/progress.o
    [thread 1][gcc] core/timebomb.o
    [thread 0][gcc] core/ini.o
    [thread 1][gcc] core/fsmon.o
    [thread 0][gcc] core/mount.o
    [thread 1][gcc] core/metrics.o
    [thread 0][gcc] core/plugins_builder.o
    [thread 0][gcc] core/sharedarea.o
    [thread 0][gcc] core/rpc.o
    [thread 1][gcc] core/gateway.o
    [thread 0][gcc] core/loop.o
    [thread 1][gcc] core/cookie.o
    [thread 0][gcc] core/querystring.o
    [thread 1][gcc] core/rb_timers.o
    [thread 0][gcc] core/transformations.o
    [thread 0][gcc] core/uwsgi.o
    [thread 1][gcc] proto/base.o
    [thread 1][gcc] proto/uwsgi.o
    [thread 1][gcc] proto/http.o
    [thread 1][gcc] proto/fastcgi.o
    [thread 1][gcc] proto/scgi.o
    [thread 1][gcc] proto/puwsgi.o
    [thread 1][gcc] lib/linux_ns.o
    [thread 1][gcc] core/yaml.o
    [thread 1][gcc] core/dot_h.o

    ----------------------------------------
Command "/usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8te7tuuc/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9e91dasm-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-8te7tuuc/uwsgi/
The command '/bin/sh -c pip3 install uwsgi' returned a non-zero code: 1

I am running the latest Docker on the latest OS X:

$ docker -v
Docker version 1.12.0-rc4, build e4a0dbc, experimental
$ uname -a
Darwin daedra.xxx.com 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64 i386 MacBookPro12,1 Darwin

Inside dockerized Alpine Linux:

# uname -a
Linux 738b7cb0ae0b 4.4.15-moby #1 SMP Tue Jul 12 14:03:08 UTC 2016 x86_64 Linux

UPDATE This has just happened on Ubuntu (as a Docker host):

...
    [thread 0][gcc] core/yaml.o
    [thread 3][gcc] core/ssl.o
    gcc: error trying to exec 'cc1': execvp: No such file or directory

    ----------------------------------------
Command "/usr/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-kwwje2x6/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jb3jm_1x-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-kwwje2x6/uwsgi/
remote: The command '/bin/sh -c pip3 install --no-cache-dir --disable-pip-version-check uwsgi' returned a non-zero code: 1

On the second run, it compiled normally!

My question

Can I do anything to make this Dockerfile build (or fail) consistently and not fail randomly?

0

RUN CFLAGS="$CFLAGS -L/lib" pip3 install uwsgi

runs consistently in similar environment

other approach:

have you tried

-e git://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip#egg=uwsgi

in your requirements.txt ?

you'll need the pcre-dev package installed

  • Didn't help: configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -L/lib -Wextra -Wno-unused-parameter ... [thread 0][gcc] core/dot_h.o ... failed with error code 1 in /tmp/pip-build-abkcepxw/uwsgi/ – Ilya Semenov Jul 25 '16 at 13:43

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.