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 collections in a Docker container.

Using 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 "<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.

Using Newman with Docker on Windows

To learn more about using Newman with Docker on Windows, go to how to run Newman in Docker for Windows.

Next steps

For more information on collection runs, see:

Last modified: 2023/09/26