Running the Container
Starting
Before running the image, you need to add your runtime configuration to the env file:
LogLevel=DEBUG
SslEnabled=false
CarmenWorkerNodeName=Carmen Worker Node#1
CarmenWorkerInitDefaultEngines=true
CarmenWorkerMaxFileSize=10485760
CarmenWorkerHandlerCount=1
CarmenWorkerBacklog=100
CarmenWorkerRequestTimeout=30
DoAnprBeforeMmr=true
ApiKey=<YOUR_API_KEY>
To simplify starting the container, we will use the run script we created earlier. Add the following code:
#!/bin/bash
BASEPATH=$(dirname "$(realpath "$0")")
DOCKER_CONTAINER_NAME=carmen-worker
PORT=${1:-8081}
NAME=${2:-SpecCarmenWorker}
echo Starting $NAME on port $PORT
docker run -d --restart always --env-file $BASEPATH/env -p $PORT:8080 --name $NAME $DOCKER_CONTAINER_NAME
The script has two optional arguments, the port and the container name. Here we are using the default options:
./run
This should start the container - you can check whether it was successful by running docker ps.
Stoppingโ
You can stop the running container with the following command:
docker stop SpecCarmenWorker
Of course, if you chose a different container name, you should use that. After stopping, it is often necessary to delete the stopped instance, which you can do by running:
docker rm SpecCarmenWorker
While developing your image, you will surely run these two commands many times, so to make this part of the process easier, let's create our final script, stop by adding the code below:
#!/bin/bash
DOCKER_CONTAINER_NAME=SpecCarmenWorker
docker stop $DOCKER_CONTAINER_NAME
docker rm $DOCKER_CONTAINER_NAME