Unable to run newman collection on docker

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Hi guys, I’m fairly new with docker, however I came across various blogs on how to run local collections on docker, but I still get an error, any help would be appreciate. I have the following that I would like to mount on the newman image

docker run -v /C:/Users/msingathi.majola/collection:/etc/postman -t postman/newman_ubuntu1404 \run “https:/www.getpostman.com/collections/xxxxx” --environment=“Test.postman_environment.json” ----ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile=“newman-report.xml”

and the error I get is as follows docker: Error response from daemon: invalid mode: /etc/postman.

Welcome @mseerah to community

Remove : from the path. try run again. It should work

/etc/postman

@gpub1 thanks for the response, however tried removing from “:/etc/postman” and it still did not work. this is what I posted now
docker run -v /C:/Users/msingathi.majola/collection /etc/postman -t postman/newman_ubuntu1404 \run “https:/www.getpostman.com/collections/xxxxx” --environment=“Test.postman_environment.json” ----ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile=“newman-report.xml”

and the error is this
error: unknown option ‘–environment=Test.postman_environment.json’

Try this there was single space in path you gave

Unfortunately with this
docker run -v /C:/Users/msingathi.majola/collection/etc/postman -t postman/newman_ubuntu1404 \run “https:/www.getpostman.com/collections/xxxxx” --environment=“Test.postman_environment.json” ----ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile=“newman-report.xml”
error: unknown option ‘–environment=Test.postman_environment.json’
it still does not work, even without the “/etc/postman”

@mseerah,

Hey there,

You need to use -- to separate flags being sent to the process in the container vs flags being sent to the Docker client. Something like this should work:

docker run -v /C:/Users/msingathi.majola/collection:/etc/newman -t postman/newman run "https:/www.getpostman.com/collections/xxxxx" -- --environment="Test.postman_environment.json" --ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile="newman-report.xml"

Best,

Kevin

hi @kevin.swiber this is very helpful, but once again I’m getting an error as follows
docker: Error response from daemon: invalid mode: /etc/newman.
** See ‘docker run --help’.**
Not really sure what is the issue with this newman folder on the image, cause when I inspect it, I don’t seem to find any issues on it

Also, I just tried to modify my drive according to something I came across from stackoverflow as follows:
docker run -v /c/Users/msingathi.majola/collection:/etc/newman -t postman/newman run "https:/www.getpostman.com/collections/xxx" -- --environment="Test.postman_environment.json" --ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile="newman-report.xml"
error: collection could not be loaded

  • unable to read data from file “https:/www.getpostman.com/collections/xxx”*
  • ENOENT: no such file or directory, open ‘https:/www.getpostman.com/collections/xxx’*

Hey @mseerah,

You’re missing a slash after the URL scheme, so it’s reading it as a file. You need to change https:/ to https://.

Best,

Kevin

Thanks @kevin.swiber this is awesome, but just a quick one, have you worked with self assigned certificates, my main problem now is that I can’t execute because of the following error error: collection could not be loaded unable to fetch data from url "https://www.getpostman.com/collections/xxx" self signed certificate in certificate chain

Hey @mseerah,

That’s weird. Perhaps it’s a bug in newman. I would brute force the insecure flag by altering a variable that will impact Node.js and see if that helps. You’ll need to add --env NODE_TLS_REJECT_UNAUTHORIZED='0' to your docker run command like so:

docker run --env NODE_TLS_REJECT_UNAUTHORIZED='0' -v /c/Users/msingathi.majola/collection:/etc/newman -t postman/newman run “https:/www.getpostman.com/collections/xxx” – --environment=“Test.postman_environment.json” --ssl-client-cert matthew.cer --ssl-client-key matthew.key --insecure --testReportFile=“newman-report.xml”

Best,

Kevin

2 Likes

Good news @kevin.swiber it’s working now, I used this command and it now works, with a lil tweak, I just changed my collection to point to my local one which is in a “.json” format instead of that url hyperlink, but thank you so much for your help :slight_smile: