Running local collection files using Docker won't work

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

2 Likes

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.

1 Like

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:

1 Like

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’

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.