繁体   English   中英

使用 docker-compose 运行时无法访问 Odoo 服务器

[英]Odoo server is not accessible when running with docker-compose

我正在尝试使用docker-compose 我已按照此处的说明进行操作。 我可以使用 Docker 启动 Postgres 和 Odoo 服务器并正确访问 Odoo 服务器。 当我运行第一个“最简单”的docker-compose示例时,它似乎可以正确启动 Postgres 服务器,但几分钟后 web 服务器会出现一条错误消息:

    Attaching to testdocker_db_1, testdocker_web_1
db_1   | 
db_1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1   | 
db_1   | 2022-09-01 14:54:47.015 UTC [1] LOG:  starting PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
db_1   | 2022-09-01 14:54:47.016 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
db_1   | 2022-09-01 14:54:47.016 UTC [1] LOG:  listening on IPv6 address "::", port 5432
db_1   | 2022-09-01 14:54:47.021 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2022-09-01 14:54:47.027 UTC [26] LOG:  database system was shut down at 2022-09-01 14:54:22 UTC
db_1   | 2022-09-01 14:54:47.033 UTC [1] LOG:  database system is ready to accept connections
web_1  | Database connection failure: connection to server at "db" (172.21.0.2), port 5432 failed: Connection timed out
web_1  |    Is the server running on that host and accepting TCP/IP connections?
web_1  | 
testdocker_web_1 exited with code 1

docker-compose.yml完全从 docker 集线器页面复制,除了我注意到我安装了 Postgresql v14,因此我更改了 postgres 图像:

version: '3.1'
services:
  web:
    image: odoo:15.0
    depends_on:
      - db
    ports:
      - "8069:8069"
  db:
    image: postgres:14
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo
      - POSTGRES_USER=odoo

我已经使用 snap 在我的 Linux Mint 21 系统上安装了 Docker。 我这样做是因为这里的安装说明在我的系统上不起作用。

我现在已经能够安装 Docker Debian 包,这个问题就解决了。

为了正确安装 Debian package,我更改了:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

至:

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM