Gurobi on docker does not find licence
AnsweredI am trying to get the the pta package to work on a docker. To do so, I make a Docker container with the following Dockerfile from the gurobi website. I need this container specifically since pta only works with python 3.8 for now. I add the following commands to the Dockerfile to install all the dependencies:
WORKDIR /root
RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get -y install sudo
RUN apt-get -y install curl
RUN apt-get install -y g++-8
RUN apt-get -y install git
RUN apt-get update && apt-get -y install cmake
RUN pip install pta
I build the docker image as follows:
docker build -t pta .
I have an academic WSL licence as shown in the gurobi licence portal. I downloaded the gurobi.lic file and now try to set the relevant information as environment variables in the image by executing:
docker run -e WLSACCESSID=........-....-....-....-............... -e WLSSECRET=........-....-....-....-............... -e LICENSEID=...... -it --entrypoint bash --name PTA pta
The dots are filled with the information from the gurobi.lic file. I now start and enter the image with:
docker start PTA
docker attach PTA
To check whether the gurobi licence is active, I run the following:
gurobi_cl
I get output in the three lines below, meaning that the licence is not found. How do I fix this?
Set parameter LogFile to value "gurobi.log"
Failed to set up a license
Error 10009: No Gurobi license found (user root, host 25d69c040d7c, hostid 0, cores 6)
In this answer on the forums, I read the following: "[...] mount it in your docker container in place of your current academic license [...]". I do not know what mounting means, so could you please give me some command line arguments that would work?
Also, I found this documentation: https://license.gurobi.com/manager/doc/overview/#Parameters but for me that is too abstract, and I cannot deduce what commands I need to type to get this Docker to work. Thank you for your help!
-
Hi Thomas,
In this answer on the forums, I read the following: "[...] mount it in your docker container in place of your current academic license [...]". I do not know what mounting means, so could you please give me some command line arguments that would work?
Mounting is a term used when binding a local file to use in the docker container. Mounting the license file you downloaded is the easiest way for this to work.
This can be done in the command line as seen in our instructions on docker-hub or the README in the GitHub repo you linked: Start a gurobi/optimizer shell instance. The command is something like:
$ docker run --volume=/my/full/path/to/gurobi.lic:/opt/gurobi/gurobi.lic:ro ...
This will mount your \(\texttt{gurobi.lic}\) file (using the full path) to the container in the directory \(\texttt{/opt/gurobi/}\) additionally the option \(\texttt{ro}\) is specified in this command which means read-only i.e. the container cannot edit the contents of this file. In other contexts, it may be useful to allow for the container to also write to the file.
I'd recommend using the up-to-date version of the Dockerfile unless you have a reason not to, right now, this is 10.0.1.
Cheers,
David0
Please sign in to leave a comment.
Comments
1 comment