Hi I am trying to practise creating new application using
$ docker run -d -P training/webapp python app.py
but getting error as
docker: Invalid containerport: training
I am using MAC OS
Share and learn in the Docker community.
Hi I am trying to practise creating new application using
$ docker run -d -P training/webapp python app.py
but getting error as
docker: Invalid containerport: training
I am using MAC OS
Are you sure it’s a capital “P”? (A lowercase “p” would probably cause that error…)
yes, It is lowercase only when I am trying it on my sysytem but just typing mistake here
If you’re typing a lowercase “-p”, that would cause your error. There’s two ways to cause Docker to expose a port:
docker run -p 12345:8000 training/webapp ...
(with a lowercase “-p”). That will cause whatever the container runs listening on port 8000 to appear at port 12345 on your host system.docker run -P training/webapp ...
(with an uppercase “-P”). docker ps
will tell you what port(s) it’s listening on.In both cases, if it is a Web application, and you’ve found out it’s on host port 12345, then typing http://localhost:12345/ into your browser will take you to it.
Thanks David, resolved the issue