Scenario: Customer want to have Licensing server in docker for simplify of update/upgrade process and simplify license update process.
Solution: Custom-build Docker container.
Solution.
Create dirs for project
mkdir /opt/lic && mkdir /opt/lic/files && mkdir /opt/lic/license && cd /opt/lic
Drop your license file to
/opt/lic/license/license.dat
Dockerfile to build container
FROM rockylinux:8.5
#########################################
## BUILD-TIME VARIABLES ##
#########################################
# url for Network Licence Manager
ARG NLM_URL=https://damassets.autodesk.net/content/dam/autodesk/www/files/linux/nlm11-19-4-1-ipv4-ipv6-linux64.tar.gz
# path for temporary files
ARG TEMP_PATH=/tmp/flexnetserver
#########################################
## ENVIRONMENTAL CONFIG ##
#########################################
# add the flexlm commands to $PATH
ENV PATH="$PATH:/opt/flexnetserver/"
#########################################
## RUN INSTALL SCRIPT ##
#########################################
COPY /files /usr/local/bin
RUN yum install -y redhat-lsb-core wget && yum clean all
## Set timezone to Regina
RUN yum install -y tzdata && yum clean all
RUN ln -sf /usr/share/zoneinfo/America/Regina /etc/localtime
WORKDIR $TEMP_PATH
RUN wget --progress=bar:force -- $NLM_URL
RUN tar -zxvf ./*.tar.gz
RUN rpm -vhi ./*.rpm
RUN rm -rf $TEMP_PATH
RUN mkdir /opt/logs
# lmadmin is required for -2 -p flag support
RUN groupadd -r lmadmin && \
useradd -r -g lmadmin lmadmin
#########################################
## VOLUMES ##
#########################################
VOLUME ["/var/flexlm"]
#########################################
## EXPOSE PORTS ##
#########################################
EXPOSE 2079
EXPOSE 2080
# want to run it under lmadmin, not root. But it not working as expected - need to do more tests.
#USER lmadmin
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# no CMD, use container as if 'lmgrd'
content of docker-compose.yml
services:
lic-server:
image: autodesk-lic-server:latest
restart: unless-stopped
hostname: "lic.your-domain.ca"
volumes:
- ./license/license.dat:/usr/local/flexlm/licenses/license.dat
- ./logs/:/opt/logs/
ports:
- "2079:2079"
- "2080:2080"
networks:
inside:
mac_address: 00:00:00:00:00:00
#Enter correct MAC for your license server
networks:
inside:
external: false
ipam:
config:
- subnet: 10.100.10.0/24
Content of control script (/opt/lic/control_lic.sh)
#!/bin/bash
case "$1" in
start)
docker compose -f /opt/lic/docker-compose.yml up -d
;;
stop)
docker compose -f /opt/lic/docker-compose.yml down
;;
restart)
docker compose -f /opt/lic/docker-compose.yml down
docker compose -f /opt/lic/docker-compose.yml up -d
;;
*)
echo "Usage: ./control_lic.sh {start|stop|restart}"
exit 1
;;
esac
content of files/entypoint.sh
#!/bin/bash
set -e
echo ""
# to help users determine their LMHostID
lmutil lmhostid
echo ""
echo "look at ./logs/log.log for more details"
echo ""
# forward all command line arguments to lmgrd
# NOTE: lmgrd -z flag is required to 'Run in foreground.' so that
# Docker will not start sleeping regardless flags.
lmgrd -z >> /opt/logs/log.log 2>&1
build container with
docker build --tag autodesk-lic-server .
start server with
/opt/lic/control_lic.sh start
done.
How to update license.
Replace license file with new one here: /opt/lic/license/license.dat.
Restart container with:
/opt/lic/control_lic.sh restart
done
how to upgrade license server.
Locate official page to download new license server release. Example: https://www.autodesk.com/support/technical/article/caas/tsarticles/ts/2HEQiQ5PtCDDk6WX0ox1mq.html
Copy direct link to new license server release. Example: https://damassets.autodesk.net/content/dam/autodesk/www/files/linux/nlm11-19-4-1-ipv4-ipv6-linux64.tar.gz
Edit Dockerfile and replace link to new license server (ARG NLM_URL=).
Rebuild container with:
docker build --tag autodesk-lic-server .
Watch for errors in output.
Restart container with:
/opt/lic/control_lic.sh restart
done