Hello Everyone, basically Today we will learn about how to run collection with the environment on docker using the docker image.
Let’s start, the simple prerequisite for this blog is that you have docker installed on your machine.
What is Postman?
Postman is an API(application programming interface) development tool that helps to build, test, and modify APIs. therefore any functionality that could need by the developer is encapsulated in this tool.
It is an HTTP client that tests HTTP requests, utilizing a graphical user interface, through which we obtain different types of responses that need to validate.
What is Docker?
Docker is a container system that has all the dependencies. which are required for the software to run and is already pre-installed. In other words, it is a virtual machine that will have all the prerequisites that a developer requires to run a particular thing, It is an application development and deployment tool that allows you to package your code and dependencies into a deployable unit known as a container.
Steps to run postman with the environment using Docker
Let’s start with the following steps:
- First, we have to install docker in our system. Run this command to install docker in our system
sudo apt install docker.io
- Now we have to run the Docker image. Postman has its own image on Dockerhub so we have to pull the latest image of a postman. To pull the image, Run this command:
docker pull postman/newman
- After running it will take some time to download the image. Now, we have to export the collection and the environment in a folder “collections” as shown below:
- Open a terminal and run this command to run postman on docker:
sudo docker run -v /home/knoldus/Desktop/Docker/collections:/etc/newman -t postman/newman:latest run "PostmanAssignment.postman_collection.json" --environment="MyEnvironment.postman_environment.json"
- After execution of the command, We will see our collection with the environment running on docker as shown below.