Run Newman with Docker on macOS, Ubuntu, and Windows

Docker is a platform for building and running applications in a virtual environment. You can use Newman to run your Postman Collections in a Docker container. When running collections in Docker, you can use all available Newman command options and run local collection files.

Use Newman with Docker on macOS and Ubuntu

To use Newman with Docker for macOS or Ubuntu, do the following:

  1. Make sure Docker is installed and running on your system. Go to Get Docker, choose your operating system, and follow the instructions.

  2. To test your Docker installation, run the following command:

    docker run hello-world
    
  3. Pull the Newman Docker image from Docker hub:

    docker pull postman/newman;
    
  4. Run Newman commands on the image. For example, to run a collection, use the collection ID and your Postman API key:

    • To get the collection ID, select a collection in the sidebar. Select the information icon Information icon and copy the ID.

    • To get an API key, go to Generate a Postman API key.

    docker run -t postman/newman run "https://api.getpostman.com/collections/<collection-id>?apikey=<your-api-key>"
    

The collection runs in Newman, and the output displays in the terminal.

The entry point to the Docker image is Newman, so you can use all Newman command line parameters. You can also run locally stored collection files. The Newman Docker documentation describes how to mount shared data volumes.

Use Newman with Docker on Windows

To learn more about using Newman with Docker on Windows, go to Using the Newman Docker Image in Windows.

Next steps

For more information about running Postman Collection runs, see the following:

Last modified: 2024/09/16