Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Creating FICO® Xpress Docker image and container

To create a FICO® Xpress image and container, Dockerfiles are provided in this repository. We provide a Dockerfile to install FICO® Xpress Solver distribution with FICO® Xpress Mosel and other interfaces, and a Dockerfile to install the FICO® Xpress Python Solver interface.

License

These Dockerfiles include FICO® Xpress software. By downloading any of these Dockerfiles, you agree to the Community License terms of the Xpress Shrinkwrap License Agreement with respect to the included FICO® Xpress software.

The images created by the Dockerfiles also contain other, separate, distinct software which may be subject to other licenses (such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained). It is the image user's responsibility to ensure that any use complies with the relevant licenses for all software contained within.

Python Dockerfile

Xpress Python Dockerfile can be found in the folder python and can be used to create an image from the Dockerfile and running a container.

To create an image, a version for both Python and Xpress must be speficied. This can be done, for example, by running the following command in the directory containing the Dockerfile:

docker image build \
    --build-arg XPRESS_VERSION=9.9.0 \
    --build-arg PYTHON_VERSION=3.14.0 \
    --tag xpress/python .

You can create a container and enter Python standard shell with the following command:

docker run --interactive --tty xpress/python

To run a Python script from your local machine, mount a directory into the container using the --volume flag. For example, to run the script /home/user/xpress-models/myscript.py:

docker run --rm \
    --volume /home/user/xpress-models:/work \
    --workdir /work \
    xpress/python \
    python myscript.py

Since the container runs as a non-privileged user (xprsuser), ensure mounted files are readable by other users, or use the --user flag to run as your host user UID:

docker run --rm \
    --volume /home/user/xpress-models:/work \
    --workdir /work \
    --user "$(id -u):$(id -g)" \
    xpress/python \
    python myscript.py

The Xpress Python package comes with a community license by default.

The Dockerfile provides a tested combination of an underlying image, a FICO® Xpress release version and a Python version.

Caution

While other combinations may be used, the resulting image might be unstable. If you build the image for an oder version of Xpress than the newest release, you might need to adjust the baseline image and python versions for older ones. The list of officially supported distributions and Python versions for each version of Xpress can be found on the official FICO® Xpress documentation. For each version of Xpress the list of officially supported distributions can be found in the supported platforms section of the official FICO® Xpress documentation.

Dockerfile for FICO® Xpress distribution

First, unpack the distribution tarball. Then, copy the Dockerfile for the distribution into the same folder as the install.sh install script, Kalis terms and conditions kalis_license.txt and the gzipped tarball.

You can download the distribution tarball in the following ways:

  1. customers find it in the FICO® download portals, and
  2. community users can find it after signing up for the FICO® Xpress Community License.

The Dockerfile provides a tested combination of an underlying image and a FICO® Xpress release version.

Caution

While other combinations may be used, the resulting image might be unstable. If you build the image for an older version of Xpress, you might need to adjust the version of the baseline image to an older one. For each version of Xpress the list of officially supported distributions and Python versions can be found in the supported platforms section of the official FICO® Xpress documentation.

Using Docker CLI

To build the Xpress image, simply invoke docker CLI inside the folder containing the files mentioned above:

docker image build \
    --build-arg=COMPONENTS="mosel,cli" \
    --tag xpress .

Where COMPONENTS represents the FICO® Xpress components to be installed.

The syntax is the following:

COMPONENTS                      'full' or comma separated list of the following components:
                                - mosel           install the FICO Xpress Mosel components
                                - kalis           install the FICO Xpress Kalis constraints programming engine for Mosel
                                - cli             install the FICO Xpress commandline interface
                                - interfaces      install the FICO Xpress Optimizer interfaces
                                - dev-components  install the FICO Xpress developer libraries and headers
                                - examples        install the Examples
                                - xpnll           install the Web Licensing Library
                                - insight-cli     install the FICO Xpress Insight commandline interface
                                defaults to minimal install

By adding 'kalis' in the list of components, the user accepts the Kalis license in 'kalis_license.txt' in the installation tarball.

Caution

In Xpress 9.6 the Web Licensing Library is not part of the full installation.

Tip

To have the full Xpress installation together with Web Licensing Library, add all above components together with xpnll as a coma separated string.

Important

The Web Licensing Library will be part of the full installation starting Xpress 9.7.

FICO® Xpress will be installed into /opt/xpressmp.

The image sets PATH to include /opt/xpressmp/bin via a Docker ENV instruction, so Xpress commands such as optimizer and mosel are available directly for all users inside the container without any additional setup.

After the image is created, an interactive container can be created with the following command:

docker run --interactive --tty --name xpress_ctn --hostname xpressmp xpress /bin/bash

Note: A community license is available inside the image in /opt.

Note: The container runs as a non-privileged user xprsuser (group xprsgroup) by default.

Example

Here is a complete workflow to install Xpress with Xpress Mosel and examples.

docker image build \
    --build-arg COMPONENTS="mosel,examples" \
    --tag xpress .
docker run \
    --interactive --tty --name xpress_ctn \
    --hostname xpressmp \
    xpress /bin/bash

Mounting your own files

To run Xpress on problem files from your local machine, mount a directory into the container using the --volume flag. For example, to solve the problem file /home/user/xpress-models/problem.mps:

docker run --rm \
    --volume /home/user/xpress-models:/work \
    --workdir /work \
    xpress \
    optimizer problem.mps

To run a Mosel model /home/user/xpress-models/model.mos:

docker run --rm \
    --volume /home/user/xpress-models:/work \
    --workdir /work \
    xpress \
    mosel model.mos

Since the container runs as a non-privileged user (xprsuser), ensure mounted files are readable by other users, or use the --user flag to run as your host user UID:

docker run --rm \
    --volume /home/user/xpress-models:/work \
    --workdir /work \
    --user "$(id -u):$(id -g)" \
    xpress \
    optimizer problem.mps

License

All files in this repository including the above mentioned Dockerfiles are licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Releases

Packages

Contributors

Languages