Creating custom Docker image and running issues

Me and my colleagues are trying to do automated testing with Docker and Lambda in AWS. To run a Docker container with Lambda, an image with my application is required. This means I have to make a Dockerfile which extends the Katalon Docker Image. I currently am using the free trial version since we are testing the software to make a decision, and to be able to run the KDI a KRE floating license is required. After thorough search, I found that the trial version includes a floating license.

When I run the command provided by the docs (with my option values) in my Terminal:

docker run -t --rm -v "$(pwd)":/tmp/project katalonstudio/katalon -projectPath=/tmp/project -browserType="Chrome" -testSuitePath="Test Suites/02 Login Phase/User Login" -apiKey="<my_API_key>"

the tests execute just fine. Some errors occur occasionally, but I digress. It tries to activate and online license and it runs just fine.

Now, the issue comes when I try to run the custom image I create. Here is my Dockerfile:

# First pull from Python to be able to run script to set env variables
# that must be kept secret
FROM python
COPY . /home/monitoring
RUN python /home/monitoring/

# The pull the katalon image to run the actual system monitoring scripts
FROM katalonstudio/katalon

COPY . /home/monitoring

CMD ["", "-projectPath=$PROJECT_PATH", "-browserType=$BROWSER", "-retry=0", "-testSuitePath='$TEST_SUITE_PATH'", "-apikey='<my_api_key>'"]

I know it seems a bit weird, but the python part is to just set some environment variables which have to be fetched from a remote server. The problems occur when I run:

docker run -t katalon_docker/test:0.1

katalon_docker/test is the name of my image. The output is the following:

Start activating offline...
Search for valid offline licenses in folder: /root/.katalon/license
The number of valid offline licenses: 0
Start activating online...
Katalon TestOps: Unexpected response, URL:, Status: 400, Response: {"error":"invalid_grant","error_description":"Invalid credentials."}
Invalid credentials.
Online activation for console mode failed.
Activation failed. Please make sure you are using a valid license.
All launchers terminated
+ ret_code=3
+ exit 3

I have tried many variations of this such as my Dockerfile containing only the FROM field and executing the run command as mentioned above, except using my docker image. This one will not work as desired, obviously. I have also tried hard coding the option values to the CMD line of the Dockerfile, but to no avail.

I would expect that the API Key option would be the starting point to resolving this issue, but I know the key is good because, as mentioned earlier, I can run a container with the image from my Terminal. Any help would be appreciated.


Hi, all!

This post can be closed as I have figured out my issue. Apparently, when creating an image the quote signs to treat text as a string where causing the error for the API key.
The CMD that made the project run was:

CMD ["sh", "-c", " -projectPath=$PROJECT_PATH -browserType=$BROWSER -retry=0 -testSuitePath=$TEST_SUITE_PATH -apikey=<my_api_key>"]

The other variables were causing issues but I got to fix that by creating a shell script which would use the environment variables.

In my opinion, the docs need a bit of improvement or extend it to cover this part where users need to extend the Katalon image and be clear that the quote signs (which are used during the docs examples) are actually not required at least for the apiKey option.

PS. I did mention that our intention was to run in AWS Lambda with a container, however, Lambda fails when the script invokes the xvfb-run command. After thorough research, lambda functions are technically not capable of running that command. It can be installed, but it requires a lot of work for what Lambda functions should be.