Installing extension inside a Dockerfile

Showing GUI or not is your choice, but you need to set up a display server to run the full application. It does not mean that you need to display a GUI at the host.

The slicer-notebook docker image that I linked above installs SlicerJupyter. Replace that by SlicerElastix and you are good.