Applies to ReadyAPI 3.3.1, last modified on August 13, 2020

About

Docker helps you run applications in virtual containers. Applications installed through Docker are platform-agnostic and can generally be installed by using a single command. SmartBear provides on-demand access to the ready-api-virtserver Docker image stored in DockerHub. This image can be used to quickly create a VirtServer instance and get to testing. This way you skip the default installation process.

Docker can be run on Windows either through VirtualBox or through Microsoft Hyper-V. Modern Docker versions use Microsoft Hyper-V by default, and use VirtualBox only if necessary. VirtServer can be run in both scenarios, but accessing a container run in VirtualBox requires additional VirtualBox configuration to expose it to your network.

Docker image

To run virtual services in Docker, use the following image from Docker Hub:

https://hub.docker.com/r/smartbear/ready-api-virtserver/

Required license

Docker runs images in temporary containers that can be removed after they are no longer needed. If you had a Fixed license installed in the container, it would be lost. To avoid this, SmartBear disabled Fixed VirtServer licenses for Docker images. Instead, contact us and request a Floating license for your VirtServer instance.

Together with the Floating license, we will provide pull access to the smartbear/ready-api-virtserver dockerhub repository that you use to download the image.

To deploy virtual services to VirtServer, you will need a ServiceV Pro license.

Hardware requirements

This topic describes how to use Docker with ReadyAPI on the Hyper-V virtualization platform. To do that, use the same environment you use to run your Docker images. There are no specific requirements for this.

To learn more, see the Docker documentation:

To run ReadyAPI tools in Docker containers on other virtualization platforms, additional configuration may be required. Please see the corresponding documentation.

Pulling VirtServer image from Docker Hub

To start working with VirtServer in Docker, you need to pull the image from Docker Hub and start it.

  • Find the image in Docker Hub:

    docker search smartbear/ready-api-virtserver
  • Pull the image to the local computer:

    docker pull smartbear/ready-api-virtserver

Docker command syntax

To run VirtServer in a Docker container, first run the docker login command and then use the following command line:

docker run -v /opt/virtserver:/virtserver -p 9090:9090 -p 8000-8010:8000-8010 -e VirtServerUser=User-Name -e VirtServerPassword=Smith -e VirtServerUserRole=admin -e DockerUser=VirtServerLicenseUser -e ACCEPT_TOU=true -e VirtServerLicenseServer=192.0.2.0:1099 docker.io/smartbear/ready-api-virtserver:latest

The docker run command starts the docker container. Then, you specify the arguments. The command above includes basic arguments you need to start VirtServer.

Arguments

docker.io/smartbear/ready-api-virtserver:latest

Required. The image to run. To get a specific VirtServer version, specify it in the tag instead of latest. You can omit docker.io/ at the start of the path.

-e VirtServerLicenseServer=192.0.2.0:1099

Required. The IP address and port of the license server.

-e ACCEPT_TOU=true

Required. Accept the SmartBear EULA before starting VirtServer. Must be true.

-p 9090:9090 -p 8000-8010:8000-8010

Required. Exposes ports 9090 and 8000-8010 to the same ports on the host computer. You need to expose port 9090 to work with VirtServer, and any ports you run the virtual services on (in this case, 8000-8010) to connect to them.

-e VirtServerUser=User-Name

Required for the first run and optional in subsequent runs. Creates a user on VirtServer. Can be omitted in subsequent runs as long as the volume persists. If specified, updates user information or creates a new user.

-e VirtServerUserRole=admin

Optional. Gives administrator rights to the created user. Recommended for the first run since only administrators can add new users.

-e VirtServerPassword=Password

A password for the created user. Can be omitted in subsequent runs as long as the volume persists. If specified, updates user information or creates a new user.

-e DockerUser=VirtServerLicenseUser

Optional. The name of the user who checks out the floating VirtServer license. You can see the user name in the License Manager. Default value: root.

-v /opt/virtserver:/virtserver

Optional. Commands Docker to create a shared file system (volume) for the VirtServer image. You can then create the /ext folder in the volume and place the .jar files you need to import in it.
For more information about working with Docker volumes, see the Docker documentation.

-e VirtServerClassPathExt=/virtserver/MyExt

Optional. The folder to load extension .jar files from. Default value: /virtserver/ext.

-e UseHTTPS=true

Optional. Commands VirtServer to use only HTTPS for connections to the client. By default, VirtServer uses a pre-generated self-signed certificate. Use the -e CertificateSubject command to generate a new self-signed certificate. Possible values: true, false. If no value is specified, VirtServer uses HTTP.

-e USAGE_STATISTICS=true

Optional. Commands the VirtServer to send usage statistics to SmartBear. Possible values: true, false. If no value is specified, the information is sent.

-e VirtServerClassPathExtras=sample:sample2

Optional. The additional elements to be added to the classpath when running VirtServer. Separate the elements with a colon.

-e CertificateSubject=/C=US/ST=MA/L=Somerville/O=SmartBear/OU=com/CN=virtserver.smartbear.local

Optional. The name properties for the generated self-signed certificate. If not specified, no certificate is generated.

Tip: For information on using certificates, see the Using Custom SSL Certificates topic.

-e CONFIG=/virtserver/newconfig.yml

Optional. The path to an alternative VirtServer settings file. If not specified, the default file is used.

-e JVM_OPT_Xmx="-DXmx=4000m"

Optional. Additional JVM options for VirtServer. Full syntax: -e JVM_OPT_<UNIQUE_NAME>="-D<OPTION><VALUE>".

Full command sample

docker run -v /opt/virtserver:/virtserver -e VirtServerClassPathExt=/virtserver/MyExt -p 9090:9090 -p 8000-8010:8000-8010 -e UseHTTPS=true -e VirtServerUser=User-Name -e VirtServerPassword=Password -e DockerUser=VirtServerLicenseUser -e ACCEPT_TOU=true -e VirtServerLicenseServer=192.0.2.0:1099 -e VirtServerClassPathExtras=sample:sample2 -e CertificateSubject=/C=US/ST=MA/L=Somerville/O=SmartBear/OU=com/CN=virtserver.smartbear.local -e USAGE_STATISTICS=true -e CONFIG=/virtserver/newconfig.yml -e JVM_OPT_Xmx="-DXmx=4000m" docker.io/smartbear/ready-api-virtserver:latest

Connecting to VirtServer in Docker

After you start VirtServer, it runs in the container and cannot be found by ServiceV automatically. You need to specify the connection manually. Depending on the Docker version you use, there are several addresses you can use:

  • Modern Docker versions attach to localhost and redirect all requests to specified ports to the container. So, you can connect to it by using the http(s)://localhost:9090 address.

  • Docker Toolbox uses Oracle VirtualBox to create containers. To connect to a container in VirtualBox, you need to specify the VirtualBox IP address. Run the docker-machine ls to see all your running docker machines. Then, use the IP address you received to connect to VirtServer at the VirtualBox address, for example http(s)://198.51.100.0:9090.

    To access VirtServer from other computers, you need to expose the VirtualBox machine to your network.

Running in a cloud

Often, you would want to run VirtServer on your cloud service. Docker provides an integrated solution to running in a cloud by the means of Docker Cloud.

To learn more about deploying services to Docker cloud, see the Getting Started tutorial in Docker documentation.

See Also

VirtServer Settings
Docker Images

Highlight search results