如何通过exec odoo11容器运行odoo 11

时间:2018-11-29 18:21:28

标签: postgresql odoo

我创建了一个包含postgres的odoo11容器(我不使用postgres作为docker映像),但是当我尝试运行odoo命令时[sudo docker exec -it pgodoo / bin / bash],我有这个例外:

root@84b713283406:/opt/odoo11# ls
extra-addons  odoo  wkhtmltopdf_0.12.1-2_amd64.deb
root@84b713283406:/opt/odoo11# /opt/odoo11/ 
extra-addons/ odoo/         
root@84b713283406:/opt/odoo11# /opt/odoo11/odoo/odoo-bin 
Running as user 'root' is a security risk.
2018-11-29 18:12:12,289 70 INFO ? odoo: Odoo version 11.0
2018-11-29 18:12:12,289 70 INFO ? odoo: addons paths: ['/root/.local/share/Odoo/addons/11.0', '/opt/odoo11/odoo/odoo/addons', '/opt/odoo11/odoo/addons']
2018-11-29 18:12:12,290 70 INFO ? odoo: database: default@default:default
Exception in thread odoo.service.httpd:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/odoo11/odoo/odoo/service/server.py", line 261, in http_thread
    self.httpd = ThreadedWSGIServerReloadable(self.interface, self.port, app)
  File "/opt/odoo11/odoo/odoo/service/server.py", line 111, in __init__
    handler=RequestHandler)
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 476, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
  File "/usr/lib/python3.6/socketserver.py", line 453, in __init__
    self.server_bind()
  File "/opt/odoo11/odoo/odoo/service/server.py", line 121, in server_bind
    super(ThreadedWSGIServerReloadable, self).server_bind()
  File "/usr/lib/python3.6/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib/python3.6/socketserver.py", line 467, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

2018-11-29 18:12:12,416 70 INFO ? odoo.addons.base.ir.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/bin/wkhtmltopdf

1 个答案:

答案 0 :(得分:0)

该地址已在使用中,因此您已经在容器中运行了Odoo。您未指定有关正在运行的容器的更多信息,因此我们不知道您的确切设置。我假设您不需要第二次运行odoo,但是应该可以从您指定的端口访问它。默认情况下,这是端口8069,因此打开http://localhost:8069会将Odoo带到您的浏览器。

如果您仍然需要运行odoo-bin,例如对于脚手架,可以使用命令行参数--http-port指定其他端口。有关命令行参数的更多信息,请参见:https://www.odoo.com/documentation/11.0/reference/cmdline.html

$ /opt/odoo11/odoo/odoo-bin --http-port 8169

这将启动Odoo,以便在本地地址http://localhost:8169中可用。

请考虑将您的设置作为容器化应用程序的反模式,因为:

  1. 手动在容器中启动应用程序。一切都应在容器定义代码中完成。
  2. 将多个事物放入同一容器中。您应该将postgres和odoo放在不同的容器中。

您可以从Unkkuri的博客文章Odoo 12 in Docker ContainerInstall Odoo version 11 in Docker Container中找到有关如何以容器化方式在Docker中运行Odoo的更多信息。