freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
547 stars 150 forks source link

Can't build docker images #1815

Closed mlissner closed 2 years ago

mlissner commented 2 years ago

It looks like the move to using buildx has broken docker builds. When I run our make command, I get:

↪ cl && make push --file docker/django/Makefile && make push --file docker/task-server/Makefile ; bush "Docker done"
docker buildx build --platform linux/amd64,linux/arm64 -t freelawproject/courtlistener-django:latest -t freelawproject/courtlistener-django:1.0.52 --file docker/django/Dockerfile .
unknown flag: --platform
See 'docker --help'.

When I run docker buildx, I get:

↪ docker buildx
docker: 'buildx' is not a docker command.
See 'docker --help'

This blog post indicates that I need to turn on experimental mode, so I can do so by exporting a variable:

$ export DOCKER_CLI_EXPERIMENTAL=enabled

After that, buildx is enabled, but:

↪ cl && make push --file docker/django/Makefile && make push --file docker/task-server/Makefile ; bush "Docker done"
docker buildx build --platform linux/amd64,linux/arm64 -t freelawproject/courtlistener-django:latest -t freelawproject/courtlistener-django:1.0.52 --file docker/django/Dockerfile .
[+] Building 0.0s (0/0)                                                                                                                 
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver (eg. "docker buildx create --use")
make: *** [docker/django/Makefile:14: image] Error 1

And that's as far as I got.

This should be built into our make command, or should be documented, or something. I'm out here debugging things when they should be working.

@flooie, can you make this your top priority, so I can build a release, please?

flooie commented 2 years ago

@mlissner 👋 on it.

flooie commented 2 years ago

@mlissner Did you run docker buildx create --use?

mlissner commented 2 years ago

Here's the latest stack trace:

#17 399.3 Setting up libavcodec58:arm64 (7:4.3.3-0+deb11u1) ...
#17 399.4 Setting up libchromaprint1:arm64 (1.5.0-2) ...
#17 399.5 Setting up libavformat58:arm64 (7:4.3.3-0+deb11u1) ...
#17 399.5 Setting up imagemagick (8:6.9.11.60+dfsg-1.3) ...
#17 399.7 Setting up libavfilter7:arm64 (7:4.3.3-0+deb11u1) ...
#17 399.7 Setting up libavdevice58:arm64 (7:4.3.3-0+deb11u1) ...
#17 399.8 Setting up ffmpeg (7:4.3.3-0+deb11u1) ...
#17 400.1 Processing triggers for libc-bin (2.31-13+deb11u2) ...
#17 400.2 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#17 400.2 Segmentation fault
#17 400.2 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#17 400.2 Segmentation fault
#17 400.2 dpkg: error processing package libc-bin (--configure):
#17 400.2  installed libc-bin package post-installation script subprocess returned error exit status 139
#17 400.2 Errors were encountered while processing:
#17 400.2  libc-bin
#17 400.4 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
failed to solve: rpc error: code = Unknown desc = process "/bin/sh -c apt-get update --option \"Acquire::Retries=3\" --quiet=2 &&     apt-get install         --no-install-recommends         --assume-yes         --quiet=2         build-essential gcc python3-dev        libpq-dev postgresql-client         curl git         antiword docx2txt ghostscript libwpd-tools poppler-utils         libmagic1         ffmpeg         imagemagick tesseract-ocr tesseract-ocr-eng         libffi-dev libxml2-dev libxslt-dev procps vim cmake" did not complete successfully: exit code: 100
make: *** [docker/django/Makefile:14: image] Error 1
mlissner commented 2 years ago

Without Qemu, you get this error:

#7 57.38 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
failed to solve: rpc error: code = Unknown desc = process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update --option \"Acquire::Retries=3\" --quiet=2 &&     apt-get install         --no-install-recommends         --assume-yes         --quiet=2         build-essential gcc python3-dev        libpq-dev postgresql-client         curl git         antiword docx2txt ghostscript libwpd-tools poppler-utils         libmagic1         ffmpeg         imagemagick tesseract-ocr tesseract-ocr-eng         libffi-dev libxml2-dev libxslt-dev procps vim cmake" did not complete successfully: exit code: 100
make: *** [docker/django/Makefile:14: image] Error 1
mlissner commented 2 years ago

Well, I've updated Ubuntu from 20.04 to 21.04 and I'm trying again. :crossed_fingers:

mlissner commented 2 years ago

OK, what a couple of days I've had. I've tried just about everything to try to get this working. In the end, where we wind up is:

  1. It appears to be impossible for me to build arm64 architecture of CourtListener using my Intel laptop. I've updated my laptop's OS twice in hopes of getting a performant version of qemu that could do this, and I've utterly failed. At present, I've given it a LOT of time to build these images, and it just doesn't seem to be able to ever finish.

  2. I'm very unimpressed with docker, buildx, and assorted technologies. I've spent the past two days trying in vein to make them work and they're just riddled with bugs and issues. Every step forward is thwarted by another crashing bug. It's sort of incredible. The only saving grace was a bug where somebody else said, paraphrasing, "It's times like these when I wonder if docker is saving me time." Indeed.

  3. For those on the new Mac's I think they're just going to have to build docker for themselves. I can't do it, unfortunately.

So this is all kind of lame. The whole point of docker is that we have a centralized spot where we store images that we all share. Nope! Not anymore, at least until this is all fixed.

I'm going to do a build the old way for now, so I can get something deployed, finally, but we need to have a conversation around how to handle our make file so it works in a good way.