How to run SoapUI mockservicerunner in a Docker container

On one of our integration projects using the IBM API Connect, we wanted to create a quick mock of our Customer's backend SOAP service. We used quite effectively a SpringBoot a few times in the past but I wondered if it would be faster (or at least more interesting) to use the mocking capabilities of the SoapUI for this purpose 🤔


You can use the prepared Docker image to run mock services created by the SoapUI in the soapui-mockservicerunner image:

docker run --rm -p 8080:8080 -v $PWD/soapui:/home/soapui/project vvidovic/soapui-mockservicerunner:latest -a "/" -p "8080" /home/soapui/project/my-soapui-project.xml

Creating mock service in the SoapUI

SoapUI is a great tool with an intuitive GUI that you can use to call and mock
SOAP web services. For example:

  • create a new project based on the WSDL
  • generate a Mock SOAP service (right-click on the interface in a projects navigator view)
  • edit generated responses and/or create new responses
  • open and edit the MockOperation
    • select the appropriate Dispatch method (XPATH, SCRIPT, RANDOM, SEQUENCE, QUERY_MATCH)
    • for example, you can select the response based on the XPath result of the request received

For more details about the SoapUI mocking features, please check SOAP Service Mocking Overview.

Running the created mock service from the command line

SoapUI doesn't stop with the GUI for your mocking needs. It have a command-line script which can be used to run your SOAP mock service without the UI.

The process to use it is quite simple:

  • create a mock service using the GUI
  • run a mock service using the provided script

For example:

./ -a '/' -p 8080 my-soapui-project.xml
  • -a: the local path to listen on
  • -p: the local port to listen on

For more information about how to run your mock services from the command line, please check the SoapUI Test Automation documentation.

Running the created mock service as a Docker container

I tried to find out if there is a SoapUI mockservicerunner image provided on the Docker Hub. I was able to find few images that bundle the SoapUI mockservicerunner but none of them provided the script as an Docker ENTRYPOINT. That means I could not trivially migrate my logic used to start mock services on local machine to a Docker container.

Well, how hard it can be to prepare a Docker image using the SoapUI binary?

Creating the soapui-mockservicerunner image

Not hard but there were few obstacles on the road, the first I encountered was:

After that, I had to prepare a Dockerfile based on the OpenJDK JRE in which I:

  • use JRE 11 or 8
  • copy the SoapUI archive to the container
  • unpack the archive, delete archive and move the resulting folder to the /opt directory
  • declare the as a Docker ENTRYPOINT
  • add a non-root user to the image
  • set a Docker WORKDIR to this user's home directory
  • set a newly create user as a user to use when running this Docker image

Full Dockerfile is here:

FROM openjdk:11-jre-slim
#FROM openjdk:8-jre-alpine

COPY ./soapui/*.tar.gz /opt/

RUN cd /opt && tar -xvf /opt/*.tar.gz && rm /opt/*.tar.gz && mv * SoapUI

ENTRYPOINT ["/opt/SoapUI/bin/"]

RUN adduser --uid 1000 --disabled-password soapui

WORKDIR /home/soapui

USER soapui

Before building this image I had to put SoapUI 5.5.0 archive to the ./soapui directory and then just execute the build command:

docker build . -t vvidovic/soapui-mockservicerunner

To make the usage of this image more simple for everyone else, I published it to a new Docker Hub repository under my user:

docker login
docker push vvidovic/soapui-mockservicerunner:latest

Using the soapui-mockservicerunner image

The end result is available in the published soapui-mockservicerunner Docker image which can be run using the following command (using your own SoapUI project):

docker run --rm -p 8080:8080 -v $PWD/soapui:/home/soapui/project vvidovic/soapui-mockservicerunner:latest -a "/" -p "8080" /home/soapui/project/my-soapui-project.xml


If you want to create a mock SOAP service for your project, an approach described here can help you to do it faster and easier:

Some of the images used in this post are provided by Pixabay users: