Subscribe to our 0800-DEVOPS Newsletter

    Get in touch

    Not sure where to start? Let our experts guide you. Send us your query through this contact form.

      Get in touch

      Contact us for all inquiries regarding services and general information

        Use the form below to apply for course

          Get in touch

          Contact us for all inquiries regarding services and general information


          How to run a SoapUI mockservicerunner in a Docker container

          clock5 minute read


          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.

          SoapUI mock operation response selection using XPath

          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.

          And now,.. creating a mock service from a Docker container

          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:

          Images used in this post are provided by Pixabay users:

          Vedran Vidović is a proactive and experienced software developer. Since 2001, he works in IT industry, and has gained extensive experience in development, analysis, design, and architecture, applying different technologies on many projects from various business domains. He has broad experience in J2EE technologies on projects of various complexity. Since 2009, he gathered extensive experience in the enterprise integration projects, using mostly IBM DataPower Gateway and IBM API Connect.

          Docker image security scanning tools


          Recent cybersecurity incidents suggest an alarming trend that’s becoming a day-to-day struggle for businesses.

          Read the article


          Get in touch

          Contact us