Classification and Language Service (CLS) using Docker
- Last Updated: May 13, 2026
- 3 minute read
- Semaphore
- Documentation
To build a docker image and containers for Classification and Language Service:
-
Create a folder for your CLS docker project. Store all the files and downloads in this folder.
-
Download all the necessary RPM (intallation) files to needed to install the Classification and Language Service. You will need:
-
A valid licence file: Copy the licence file to project folder and name
licence. -
Java 11 x64: A supported JDK. In this example, we will be using Amazon Corretto JDK 11 RPM for Linux x64.
-
Licenced base and all language pack RPMs installation files
-
Classification Server RPM installation file
See Semaphore component installation files for a list of RPM installation files.
-
-
Create a file named
start-cs.shthat is comprised of the following:#!/bin/bash function shutdown { exit } echo echo "Starting Semaphore Classification Server on port 5058" /opt/semaphore/CS/bin/ClassificationServer --daemon --nouserswap echo trap shutdown SIGHUP SIGINT SIGTERM while true do sleep 1 doneYou will use this script to launch containers. This script launches the Classification Server as a background process, and then sleeps periodically until the container stops. The
trapcommand maps certain process signals to our custom shutdown function, which exits the script. -
Once all the prerequisites are copied to your project folder, build the Dockerfile. The Dockerfile peforms the following tasks:
-
Starts by using the Oracle Enterprise Linux version 8 image
-
Installs all the RPMs
-
Configures some environment variables, including the SEMAPHORE_JVM_LIB variable necessary for CS language packs
-
Copies files and scripts onto the local image
-
Defines the exposed ports and
/var/opt/semaphoreas our external volume. The external volume at/var/opt/semaphoreis very important so that you can mount a named external volume. This will ensure you do not lose logs, rulebase files and customizations each time you deploy.
The folloiwng is an example of the docker file:
FROM oraclelinux:8 # Copy local RPMs and licence file to image RUN mkdir /local-rpms/ COPY *.rpm /local-rpms/ # Get package updates and install rpms, and clean up. RUN yum -y --setopt=tsflags=nodocs update && \ yum install -y --setopt=tsflags=nodocs patch && \ yum install -y --setopt=tsflags=nodocs /local-rpms/java-11-amazon-corretto-devel-11.0.*.*.rpm && \ yum install -y /local-rpms/Semaphore-LanguagePack-Linux-Base-5.6.0.rpm && \ yum install -y /local-rpms/Semaphore-LanguagePack-Linux-English-5.6.0.rpm && \ yum install -y /local-rpms/Semaphore-ClassificationServer-5.6.3-1.x86_64.rpm && \ yum clean all # Copy licence file from local dir to image. COPY ./licence /opt/semaphore/licence COPY ./start-cs.sh /opt/semaphore/start-cs.sh RUN chmod 777 /opt/semaphore/start-cs.sh ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/semaphore ENV SEMAPHORE_JVM_LIB /etc/alternatives/jre/lib/server/libjvm.so EXPOSE 5058 5059 VOLUME ["/var/opt/semaphore"] ENTRYPOINT ["/opt/semaphore/start-cs.sh"] -
-
Build the image using the following command:
docker build -t cs563 . -
Once the image is successfully built, run to build a container instance using the following command:
docker run -d --name cs563-1 -p 5058:5058 -p 5059:5059 \ --mount src=sem5_cs_volume,target=/var/opt/semaphore,type=volume \ cs563Note the use of the
--mountflag. It is very important to use a named volume for the external volume indicated at/var/opt/semaphore.If successful, you can see this container running by using the
docker pscommand. For example:CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 41449c264afd cs563 "/opt/semaphore/star..." 32 minutes ago Up 31 minutes 0.0.0.0:5058-5059->5058-5059/tcp cs563-1 -
To confirm that the Classification Server is running, navigate to the following address in a web browser:
http://localhost:5059Note: This value is dependent on you opening the CAT tool port of
5059, as shown with the patch command in docker file.