How to use raco in Docker: Needed Ubuntu packages

Looking to put Racket in a Docker container based on Ubuntu Linux? Make sure you install the right Ubuntu packages, especially if you’re looking to use raco to install some additional Racket packages. Installing racket alone won’t cut it. You will get errors involving SSL and, if you’re using Ubuntu Linux 16.04, sqlite (see below).

In short, if you’re running Ubuntu 16.04 (Xenial Xerus), your should install

If you’re running 17.04 (Zesty Zapus), you can omit sqlite from the list above.

Here’s what you see if you install only the racket package and the txexpr package. Imagine your Dockerfile looks like this:

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y racket RUN raco pkg install --batch --deps search-auto txexpr CMD ["racket"]

The result of docker-compose build will be (omitting tons of output), once it gets to the step where raco is to be run, is:

...
Step 3/4 : RUN raco pkg install --batch --deps search-auto txexpr
---> Running in 12926cb24330
Resolving “txexpr” via http://download.racket-lang.org/releases/6.3/catalog/
Resolving “txexpr” via http://pkgs.racket-lang.org
Downloading repository git://github.com/mbutterick/txexpr
ssl-connect: requested protocol not supported;
SSL not available; check `ssl-load-fail-reason’
requested: ‘auto
context...:
/usr/share/racket/collects/openssl/mzssl.rkt:611:0: make-raw-context
/usr/share/racket/collects/openssl/mzssl.rkt:482:18
/usr/share/racket/collects/racket/private/more-scheme.rkt:265:2: call-with-exception-handler
...

If you omit, say, ca-certificates, here’s the error you’ll find (whether you’re on 16.04 or 17.04):

Step 3/4 : RUN raco pkg install --batch --deps search-auto txexpr
---> Running in f40b3dc152cb
Resolving “txexpr” via https://download.racket-lang.org/releases/6.7/catalog/
ssl-connect: connect failed (error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed)
context...:
/usr/share/racket/collects/openssl/mzssl.rkt:1442:8: loop