VOOZH about

URL: https://hub.docker.com/r/postman/newman/

⇱ postman/newman - Docker Image


postman/newman

By postman

Updated about 2 years ago

Command-line collection runner for Postman

Image
79

10M+

postman/newman repository overview

👁 newman-docker logo

newman-docker

This repository contains docker images for Newman.

Newman is a command-line collection runner for Postman. It allows you to effortlessly run and test a Postman Collections directly from the command-line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.

New to Docker? Docker allows you to package an application with all of its dependencies into a standardised unit for software development. Visit https://www.docker.com/whatisdocker to read more about how docker can drastically simplify development and deployment.

Using the docker image

The docker image for Newman is available for download from our docker hub. You must have Docker installed on your system. Docker has extensive installation guideline for popular operating systems. Choose your operating system and follow the instructions.

Ensure you that you have docker installed and running in your system before proceeding with next steps. A quick test to see if docker is installed correctly is to execute the command docker run hello-world and it should run without errors.

Step 1:

Pull the newman docker image from docker hub:

docker pull postman/newman;

Step 2:

Run newman commands on the image:

docker run -t postman/newman run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"
Build the docker image from this repository

Step 1:

Clone this repository:

git clone https://github.com/postmanlabs/newman.git

Step 2:

Build the image:

docker build -t postman/newman:alpine --build-arg NEWMAN_VERSION="full semver version" docker/images/alpine

Step 3:

Run a collection using the newman image:

docker run -t postman/newman:alpine https://www.getpostman.com/collections/8a0c9bc08f062d12dcda

Running local collection files

This docker image is designed to pick files from the /etc/newman directory within the image. You may mount the directory of your collection files into that location and provide the file references in standard newman parameters.

# Mount host collections folder ~/collections, onto /etc/newman on the docker image, so that newman
# has access to collections
docker run -v ~/collections:/etc/newman -t postman/newman:alpine HTTPBinNewmanTest.json.postman_collection

You are not required to mount a volume if you do not need to save newman report to the host, and your collection is available online, unless your collection requires an environment (as environments cannot be passed as URLs).

To know more about mounting volumes, visit docker documentation on shared data volumes.

Examples

Run a remote collection, pass it a local environment, and save JUnit XML test report on the host

docker run -v ~/collections:/etc/postman -t postman/newman \
 https://www.getpostman.com/collections/df0a40ef41d570c48154 \
 --environment="HTTPBinNewmanTest.json.postman_environment" \
 --reporters junit --reporter-junit-export="newman-report.xml"

Use a script to run a collection and do something, for example, deploy the build, if all the tests pass

#/bin/bash

# Stop on first error
set -e;

function onExit {
 if [ "$?" != "0" ]; then
 echo "Tests failed";
 # build failed, don't deploy
 exit 1;
 else
 echo "Tests passed";
 # deploy build
 fi
}

trap onExit EXIT;

docker run -t postman/newman:alpine https://www.getpostman.com/collections/8a0c9bc08f062d12dcda --suppress-exit-code;
Alpine Linux

x.y.z-alpine: Precise Newman version on the latest version of Alpine Linux x.y.z: Same as the one above.

x.y-alpine: Latest minor version Newman release on the latest version of Alpine Linux x.y: Same as the one above.

x-alpine: Latest major Newman version on the latest version of Alpine Linux x: Same as the one above.

latest: Latest Newman on the latest version of Alpine Linux alpine: Similar to the above.

Ubuntu

x.y.z-ubuntu: Precise Newman version on Ubuntu LTS x.y-ubuntu: Latest Newman minor version release on Ubuntu LTS x-ubuntu: Latest major version Newman release on Ubuntu LTS ubuntu: Latest Newman version on Ubuntu LTS.

To report bugs/send feature requests, head over to https://github.com/postmanlabs/newman/issues/new

Tag summary

6-ubuntu

Content type

Image

Digest

sha256:f63ccfd66…

Size

125.3 MB

Last updated

about 2 years ago

Requires Docker Desktop 4.37.1 or later.