我正在尝试使用docker-compose
运行Odoo。我已经按照这里的指示做了。我可以使用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 hub页面复制的,只是我注意到我安装了Postgresqlv14,所以我更改了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软件包正确安装,我更改了:
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