Run OMERO.web in Docker

Overview

Teaching: 10 min
Exercises: 25 min
Questions
  • How can I run OMERO.web in Docker

Objectives
  • Further develop the OMERO python image to run OMERO web.

This builds on previous lessons to create an OMERO.web image running in development mode.

Start with the image built in the previous lesson

docker run -it my-omeropy-image omero web start
ERROR: Django not installed!
omero>

Additional dependencies for OMERO.web

Install OMERO.web’s Python dependencies. Ignore Nginx for now. The OMERO.web documentation should be helpful.

Solution

Add this line:

RUN pip install -r /home/omero/OMERO.py/share/web/requirements-py27.txt

It would be nice if OMERO.web could automatically run when the container is started, instead of requiring a manual step. The CMD line can be changed to do this:

CMD ["/home/omero/OMERO.py/bin/omero", "web", "start", "--foreground"]

The --foreground flag is necessary because OMERO.web defaults to running in the background as a daemon, but Docker will exit as soon as the foreground process completes.

Build the updated docker image, and run it. OMERO.web listens on port 4080 be default, so forward this: ~~~ docker run -d –name my-omeroweb -p 14080:4080 my-omeropy-image and you should be able to see OMERO.web in your web browser http://localhost:14080

OMERO.web configuration

As you will know from the OMERO web documentation Nginx is required to serve static files (e.g. javascript and CSS). However you can run OMERO.web in development mode for testing, bypassing the requirement for Nginx.

Set OMERO.web to run in development mode

Edit the Dockerfile to configure OMERO.web to use the built-in development server.

Solution

Add these lines after the RUN omego download python ... line:

RUN /home/omero/OMERO.py/bin/omero config set omero.web.application_server development
RUN /home/omero/OMERO.py/bin/omero config set omero.web.debug True

Key Points