I think even the rosmaster is run by local host, in normal use cases it should also be accessible from the outside world. I can connect to my rosmaster running on my laptop from the container, by doing
export ROS_MASTER_URI=http://<IP of laptop>:80
Therefore, running a roscore on a local laptop and accessing it from a container works.
However what doesn’t work, is running a rosmaster in the container and accessing it from the laptop.
When I run roscore on port 80 (in the container) and launch a ros node, XML-RPC server spits an error that the it cannot contact the master.
$ export ROS_MASTER_URI=http://<IP of laptop>:80
$ roslaunch <launchfile>.launch
started roslaunch server http://localhost:37337/
auto-starting new master
process[master]: started with pid 
ERROR: Unable to start XML-RPC server, port 80 is already in use
Unhandled exception in thread started by <bound method XmlRpcNode.run of <rosgraph.xmlrpc.XmlRpcNode object at 0x7f02189d42d0>>
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 215, in run
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 284, in _run
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 234, in _run_init
self.server = ThreadingXMLRPCServer((bind_address, port), log_requests)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/xmlrpc.py", line 115, in __init__
SimpleXMLRPCServer.__init__(self, addr, SilenceableXMLRPCRequestHandler, log_requests)
File "/usr/lib/python2.7/SimpleXMLRPCServer.py", line 593, in __init__
SocketServer.TCPServer.__init__(self, addr, requestHandler, bind_and_activate)
File "/usr/lib/python2.7/SocketServer.py", line 417, in __init__
File "/usr/lib/python2.7/SocketServer.py", line 431, in server_bind
File "/usr/lib/python2.7/socket.py", line 228, in meth
socket.error: [Errno 98] Address already in use
I have read in the documentation that for single container applications I do not need to expose ports. Should I try and manually exposing the ports? Does it matter that it I am using it on runtime?
Thank you in advance,