I am trying to imitate the launch of a container web application displayed on some port
sudo docker run -d -p 1338:1337 kermit/hellonode
in Python using docker-py . So far, I got this code to run the instance:
container = c.create_container('kermit/hellonode', name='hello')
c.start(container, port_bindings={1337: ('0.0.0.0', 1338)})
But I can’t access the container on the public port 1338 (which usually works with the first command) - I get a refusal to refuse a connection. Does anyone know if I am missing any option to force a Python call to create a functional accessible container?
Checking the container tells me that the port is configured the way it should be:
$ sudo docker port hello 1337
0.0.0.0:1338
I also experimented with the option ports=[1337]in the call create_container, but that didn't help either.
: , - . , TCP:
container = c.create_container('kermit/hellonode', name='hello', ports=[(1337, 'tcp')])