Follow the below steps to build a docker image and run tests:
1. Create a Dockerfile in your project directory with below content.
C:/Projects/HelloWorldApplication/Dockerfile
FROM maven:3.5.3-jdk-8-alpine COPY ./. /
2. Open a command prompt and navigate to your project directory.
3. Run the following docker command to build image from the Dockerfile.
C:\Projects\HelloWorldApplication>docker build --no-cache -t qascript:latest -f ./Dockerfile .
4. Run the following docker command to enter the container and open a terminal inside it.
docker run -it --rm qascript:latest /bin/sh
5. Run the maven command to run your tests inside the docker container.
mvn test