Development with Docker

I’ve spent a few hours trying to get to a point where I can run Metabase from source in a Docker container. I started by modifying the included Dockerfile (e.g. removing the call to bin/build, not removing installed packages, changing entry point to do nothing).

I noticed the dependencies list says openjdk-8, but the Dockerfile is built from java:openjdk-7-jre-alpine.

yarn && yarn run build-hot seem to work, but I get an error from lein ring server:

06-10 17:25:19 INFO metabase.core :: Metabase Initialization COMPLETE
Started server on port 3000
Exception in thread "main" java.awt.HeadlessException, compiling:(/tmp/form-init6394606016271386868.clj:1:73)
	at clojure.lang.Compiler.load(
	at clojure.lang.Compiler.loadFile(
	at clojure.main$load_script.invokeStatic(main.clj:275)
	at clojure.main$init_opt.invokeStatic(main.clj:277)
	at clojure.main$init_opt.invoke(main.clj:277)
	at clojure.main$initialize.invokeStatic(main.clj:308)
	at clojure.main$null_opt.invokeStatic(main.clj:342)
	at clojure.main$null_opt.invoke(main.clj:339)
	at clojure.main$main.invokeStatic(main.clj:421)
	at clojure.main$main.doInvoke(main.clj:384)
	at clojure.lang.RestFn.invoke(
	at clojure.lang.Var.invoke(
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.Var.applyTo(
	at clojure.main.main(
Caused by: java.awt.HeadlessException
	at java.awt.GraphicsEnvironment.checkHeadless(
	at java.awt.Window.<init>(
	at java.awt.Frame.<init>(
	at java.awt.Frame.<init>(
	at javax.swing.JFrame.<init>(
	at clojure.lang.Var.invoke(
	at ring.server.standalone$open_browser_to.invokeStatic(standalone.clj:38)
	at ring.server.standalone$open_browser_to.invoke(standalone.clj:37)
	at ring.server.standalone$serve$fn__3616.invoke(standalone.clj:106)
	at ring.server.standalone$try_port.invokeStatic(standalone.clj:16)
	at ring.server.standalone$try_port.invoke(standalone.clj:10)
	at ring.server.standalone$serve.invokeStatic(standalone.clj:99)
	at ring.server.standalone$serve.doInvoke(standalone.clj:75)
	at clojure.lang.RestFn.invoke(
	at ring.server.leiningen$serve.invokeStatic(leiningen.clj:13)
	at ring.server.leiningen$serve.invoke(leiningen.clj:10)
	at user$eval47172.invokeStatic(form-init6394606016271386868.clj:1)
	at user$eval47172.invoke(form-init6394606016271386868.clj:1)
	at clojure.lang.Compiler.eval(
	at clojure.lang.Compiler.eval(
	at clojure.lang.Compiler.load(
	... 14 more

I’m trying again with v7 of openjdk, but it’s getting a little old waiting for everything to download/compile/pack/whatever each time :frowning:

Is anyone else doing this? Any hints?

I’d strongly suggest developing without docker. None of us on the core team uses it during development, and it’s just a deployment target. To create an image you should use bin/ and bin/

Other than that, I’d suggest just going by the flow described in the wiki on setting up a dev environment.

I’d rather keep my host machine relatively clean, and I’m not used to this stack at all, so I’m kind of flailing around. I might have to abandon the idea, but it’s a fun exercise. Building a container hasn’t been much of a problem, but it’s a slow process for trying to make small changes while I learn.

(edit: wasn’t looking far enough into the docs folder, re-found some stuff, thanks!) Is that the GitHub wiki you’re talking about for environment setup instructions? I don’t see those, but the wiki does have some great info that I didn’t know about.

Also, I was using the Docker file in the project root, thanks for pointing out the (now obvious) Docker stuff in src! That changes a lot :slight_smile:

I abandoned (for now?) trying to use a Docker container as a development server… The backend lein ring server kept failing with some kind of error from AWT about being headless. I don’t know why it cares, and even trying a simple JAVA_TOOL_OPTIONS for headless mode didn’t work.

The AWT headless error can be ignored