Skip to content

Instantly share code, notes, and snippets.

@twitu
Created July 14, 2020 06:13
Show Gist options
  • Save twitu/9a6b72d8d8a90a2715f5c47166615dfe to your computer and use it in GitHub Desktop.
Save twitu/9a6b72d8d8a90a2715f5c47166615dfe to your computer and use it in GitHub Desktop.
Running MiniZincIDE AppImage in a Docker container
FROM ubuntu:16.04
RUN apt-get -y upgrade
RUN apt-get -y update
RUN apt-get install -y libglib2.0-dev libx11-dev libglu1-mesa-dev libfontconfig1 libasound2 libegl1-mesa dbus x11-xserver-utils wget dbus
RUN dbus-uuidgen > /var/lib/dbus/machine-id
RUN wget -c https://github.com/MiniZinc/MiniZincIDE/releases/download/2.4.3/MiniZincIDE-2.4.3-x86_64.AppImage -O minizinc.AppImage
RUN chmod +x minizinc.AppImage
RUN ./minizinc.AppImage --appimage-extract
CMD ["/squashfs-root/AppRun"]
@twitu
Copy link
Author

twitu commented Jul 14, 2020

Linked to issue MiniZinc/MiniZincIDE#108

The Docker file downloads required graphical packages, downloads and extracts minizinc and sets up a command to run it. The following steps should get your IDE running on a linux system. I have tested it for my Ubuntu 20.04 system.

  1. Paste this snippet in a file called minizinc.docker
  2. docker build -t minizinc-gui -f minizinc.docker .
  3. xhost +local:docker
  4. sudo docker run -ti --rm --net=host -e DISPLAY=:1.0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME/.Xauthority:/root/.Xauthority -v /home/code/basic-discrete-optimization/:/home/basic --env="QT_X11_NO_MITSHM=1" --privileged minizinc-gui

The -v /home/code/basic-discrete-optimization/:/home/basic creates a volume that links the code directory in your local system with a home/basic directory inside the docker container. Change it according to your needs.

I do not know the exact purpose of all the options used here, they are cobbled together from different SO answers. Please correct me if there's a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment