OpenNMT Forum

Docker image to run on 2 ports

Hi,

I had downloaded the opennmt/opennmt:latest docker. I used it on port 7784 for english -german translation. But if it is publish on the port 7785 for german -english. it publishes teh image on 7785. But when I send a request it throws the following error :

**administrator@:~/OpenNMT$ python3 translate_de_en.py
Enter the sentence ==> Hallo Welt
Traceback (most recent call last):
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1055, in _send_output
self.send(chunk)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 977, in send
self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/adapters.py”, line 449, in send
timeout=timeout
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/util/retry.py”, line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/packages/six.py”, line 685, in reraise
raise value.with_traceback(tb)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 354, in _make_request
conn.request(method, url, **httplib_request_kw)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 1055, in _send_output
self.send(chunk)
File “/home/administrator/Desktop/python/lib/python3.7/http/client.py”, line 977, in send
self.sock.sendall(data)
urllib3.exceptions.ProtocolError: (‘Connection aborted.’, BrokenPipeError(32, ‘Broken pipe’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “translate_de_en.py”, line 29, in
translate_de_en()
File “translate_de_en.py”, line 18, in translate_de_en
response = requests.post(url, json=params, headers=headers)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/api.py”, line 116, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/api.py”, line 60, in request
return session.request(method=method, url=url, **kwargs)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/sessions.py”, line 533, in request
resp = self.send(prep, **send_kwargs)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/sessions.py”, line 646, in send
r = adapter.send(request, kwargs)
File “/home/administrator/Desktop/python/lib/python3.7/site-packages/requests/adapters.py”, line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, BrokenPipeError(32, ‘Broken pipe’))
administrator@:~/OpenNMT$

How do I go ahead resolving this error ?
Any idea on this. Please support me to resolve this issue.

Thank You,
Kishor.

Hi,

The issue is resolved now. I am ableto run the docker image on 2 ports and comfortably get responses from both of them.

Kind Regards,
Kishor.