Running local collection files using Docker won't work

Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

Hi all,

I have successfully installed Docker, pulled newman docker image and run newman commands on the image just to make sure that all works. Then I successfully run a collection using the newman image: docker run -t postman/newman:ubuntu run https://www.getpostman.com/collections/8a0c9bc08f062d12dcda

When it comes to Running Local Collection Files in Docker I always get error. The command I run is:

C:\Users\martinsv>docker run -v ~/collections:/etc/newman -t postman/newman:ubuntu run "Kwaki.collection.postman_collection.json"

Then I get this error:

error: collection could not be loaded
  unable to read data from file "Kwaki.collection.postman_collection.json"
  ENOENT: no such file or directory, open 'Kwaki.collection.postman_collection.json'

This is the directory that I created in my disk:

C:\Users\martinsv>cd collections

C:\Users\martinsv\collections>dir
 Volume in drive C is OSDisk
 Volume Serial Number is 72C8-6C0A

 Directory of C:\Users\martinsv\collections

09/02/2021  19:24    <DIR>          .
09/02/2021  19:24    <DIR>          ..
09/02/2021  19:24            10,093 Kwaki.collection.postman_collection.json
08/02/2021  11:00            10,093 Kwaki_test.json
08/02/2021  11:03               507 Postman_environment.json
               3 File(s)         20,693 bytes
               2 Dir(s)  96,579,678,208 bytes free

Please anyone can help? I spent hours to figure it out without success.

Thanks a lot

Hey @Martikwak

Not sure if it will get you further forward but I run it like this, using my image, which is Newman plus the htmlextra reporter.

I would assist you more but I’m not at my machine right now :grin:

Hey @Martikwak,

Looks like you’re on Windows. Can you try including the full path in your volume flag?

Command Prompt:

docker run -v C:/Users/martinsv/collections:/etc/newman -t postman/newman:ubuntu run Kwaki.collection.postman_collection.json

You can always use a variable for the current directory, as well. So on the regular Windows Command Prompt, I believe that would look like %cd%/collections while I believe you can use ${pwd}/collections in PowerShell.

Hope that helps.

Best,

Kevin

Hi @danny-dainton, thank you for the info. Surely I will take a look. In Jenkins I have been using different reports and also htmlextra which is my favorite one.

Hi @kevin.swiber that is correct. I switched to Windows Command Prompt therefore it didn’t work besides that I’m pretty new using CLI.
Thanks heaps! It works like a charm :grinning:

it seems the same problem but on Mac, i’am newbie, can i ask how to solve this problem. Thank you so much!
Phans-MacBook-Air:~ root# newman run postman_collection.json
error: collection could not be loaded
unable to read data from file “postman_collection.json”
ENOENT: no such file or directory, open ‘postman_collection.json’