How to expose ports?

488 views Asked by At

I am trying to expose two ports in docker container 6633 and 8080 , and try to connect one application from external host,in simple term I am trying to connect Open-Flow switches running on external host to Open-Flow controller running on docker container,But I am not able to connect,how am I suppose to expose the ports in docker and get this connection done?

2

There are 2 answers

3
Bryan On

If you're only going to do this once on your host, and assuming they are TCP ports, you can 'publish' them like this:

sudo docker run -p 6633:6633 -p 8080:8080 my_image

The -p option is described more at the top of this page: http://docs.docker.com/userguide/dockerlinks/

0
Hy L On

Are you using dockerfile? In the dockerfile, you could simply add this:

EXPOSE 6633