sudo docker pull apimastery/apisimulator
API Simulator in Docker Container
If you use Docker containers already, the API Simulator Docker image can help you incorporate API Simulator in your development and testing life cycle. (If you are not using containers you definitely should look into it!)
The image contains a Linux distribution, OpenJDK Java Runtime Environment (JRE), and installation of the API Simulator’s distro that have been tested to work together.
The same Docker image can be used to run API Simulator and API Recorder as well.
An already built image is hosted on Docker Hub here.
We assume that you already have Docker installed and can execute
Execute the following to get the latest Docker image from Docker Hub:
For the Response Templating examples, start the container using this command:
sudo docker run --rm -d --name apisimulator -p 6090:6090 -t apimastery/apisimulator apisimulator start examples/response-templating
Now you can just follow the instructions in the
README.txt file found in the example’s directory in the distro for how to submit requests using
API Client is a simple tool that comes bundled with API Simulator. It allows the submission to HTTP or HTTPS endpoints of raw HTTP requests stored in files.
Let’s drop into a
sh shell inside the container:
sudo docker run -it apimastery/apisimulator sh
Now just follow the instructions in the
README.txt file found under each of the example simulations.
Let’s assume your simulation is in a directory
on Docker daemon’s host. The following command will start API Simulator for
my-awesome-simulation simulation after mounting the host directory,
/opt/apisimulator/apisims/my-awesome-simulation, into the API Simulator container at
sudo docker run --rm -d --name apisimulator -p 6090:6090 -v /opt/apisimulator/apisims/my-awesome-simulation:/apisims/my-awesome-simulation -t apimastery/apisimulator apisimulator start /apisims/my-awesome-simulation
Notice that you may have to use
-u <uid> in the command above to assure that the log files will be properly created in the
/opt/apisimulator/apisims/my-awesome-simulation/logs directory. The
<uid> is that of the user who owns the logs directory or belongs to the directory owner’s group.
If you get an error like this
docker: Error response from daemon: Conflict. The name "/apisimulator" is already in use…., execute the following command first and then the command above to run API Simulator:
sudo docker rm apisimulator
We would love to hear your feedback! Shoot us a quick email to [feedback at APISimulator.com] to let us know what you think.
Happy API Simulating!