This question has been flagged
2 Replies
13369 Views

Github Issue to this: https://github.com/odoo/docker/issues/380

My Repo:https://github.com/Stakdek/docker-odoo


I have a naked PSQL and Odoo Docker with docker-compose configured.
After I started the docker Odoo wants to serve on cece3aa227a5:8069, so localhost:8069 is also not working…

Response from Chrome: Page is not working.

System: Ubuntu 20.04 LTS

Command: docker-compose up

docker-compose.yml:

version: '2.0'
services:
  # Information needed set up an odoo web
  # application container.
  web:
    image: odoo:14.0
    container_name: odoo_14
    depends_on:
    - db
    # Port Mapping
    #We need to map the port on the host machine(left side) to the
    #Port inside the container on the right. By default Odoo
    #Runs on port 8069 and inside the container, it is running on 8069.
    #Locally we are going to access it via localhost:9000
    ports:
    - 8069:8069
    # Data Volumes
    # --------
    #
    # This defines files that we are sharing from the host machine
    # into the container.
    #
    #Here we are using to map the extra add ons or enterprise addons
    # as well as the configuration file. Also, we need to map the data
    #directory where Odoo will storesome attachments etc.
    volumes:
    - ./data/odoo:/var/lib/odoo
    - ./config:/etc/odoo
    - ./addons:/mnt/addons
    - ./enterprise:/mnt/enterprise
    #Username and password of the Host DB
    # Make sure to give the same credentials
    #inside the postgres service
    environment:
    - HOST=db
    - USER=odoo14
    - PASSWORD=odoo14
   # All of the information needed to start up a Postgresql
# Container.
  db:
    image: postgres:10
    container_name: postgres_10
    ports:
    - 5432:5432
    #Add this volume to map the Postgres data. It may be lost
    #if we execute docker-compose down where all the data
    #in the layered file system will be lost
    volumes:
    - ./data/postgres:/var/lib/postgresql/data
    #make sure to use the same which were given above.
    environment:
    - POSTGRES_PASSWORD=odoo14
    - POSTGRES_USER=odoo14
    - POSTGRES_DB=postgres

Docker Output:

docker-compose up
Starting postgres_10 ... done
Recreating odoo_14   ... done
Attaching to postgres_10, odoo_14
postgres_10 | 
postgres_10 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_10 | 
postgres_10 | 2021-07-23 11:20:41.534 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres_10 | 2021-07-23 11:20:41.534 UTC [1] LOG:  listening on IPv6 address "::", port 5432
postgres_10 | 2021-07-23 11:20:41.545 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_10 | 2021-07-23 11:20:41.585 UTC [26] LOG:  database system was shut down at 2021-07-23 11:20:38 UTC
postgres_10 | 2021-07-23 11:20:41.595 UTC [1] LOG:  database system is ready to accept connections
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: Odoo version 14.0-20210720 
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf 
odoo_14 | 2021-07-23 11:20:42,480 1 INFO ? odoo: addons paths: ['/usr/lib/python3/dist-packages/odoo/addons', '/mnt/extra-addons', '/mnt/enterprise'] 
odoo_14 | 2021-07-23 11:20:42,481 1 INFO ? odoo: database: odoo14@db:5432 
odoo_14 | 2021-07-23 11:20:42,622 1 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf 
odoo_14 | 2021-07-23 11:20:42,707 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on cece3aa227a5:8069 

Avatar
Discard
Best Answer

I had this exact problem and what fixed it for me was to run:

$ sudo chown 101 data/

On the host machine, if data/ is the directory being mounted to /var/lib/odoo in the container. 

What seems to be the problem is that odoo expects this directory to be owned by the "odoo" user inside the container, which has UID 101.  But if the directory doesn't exist, it's created with the docker image, but it gets created by root and is owned by root.  

Avatar
Discard

This is definitely the answer. Had this problem as well when I first ran odoo in docker. Alternatively you can use volumes instead of bind mounts to avoid this issue.

That's right

Best Answer

Hi, please check this answer:
https://www.odoo.com/forum/help-1/odoo-installed-and-running-on-0-0-0-0-8069-but-not-in-browser-waiting-for-answer-112630
Additionally You can add these lines to config file

xmlrpc_interface = 127.0.0.1
http_interface = 127.0.0.1 http_port = 8069
Avatar
Discard
Author

No difference with the additional lines. Except the Log says now:

odoo_14 | 2021-07-30 12:47:09,707 1 INFO ? odoo.service.server: HTTP service (werkzeug) running on localhost:8069

Author

Also my firewall is completely down. So no firewall problem… but thank you for the suggestion!

Author

After trying to connect to the address, this message docker is logging:

odoo_14 | 2021-07-30 12:48:27,033 1 INFO ? odoo.http: HTTP Configuring static files

Author

A curl from INSIDE the docker:

odoo@9e5d9f74237d:/$ curl http://localhost:8069

curl: (52) Empty reply from server

Ok, now i see next probably helpfull answer: https://www.odoo.com/forum/help-1/installing-odoo-11-enterprise-on-ubuntu-16-4-running-on-opensvc-129095

it considers topic of curl: (52) Empty reply from server

Author

odoo@c1dd7a200ceb:/$ ls -lisah /var/lib/

total 52K

21763683 4.0K drwxr-xr-x 1 root root 4.0K Jul 28 23:29 .

21243975 4.0K drwxr-xr-x 1 root root 4.0K Jul 21 00:00 ..

17177596 4.0K drwxr-xr-x 2 root root 4.0K Jul 23 13:19 odoo

It could be a permission error… How can I tell docker-compose to change the permission? In the container is no sudo, so i cannot change the permission after starting the container

Author

if I do "sudo chown -R 1000:1000 ./data/odoo" it works inside the container. But not from host… My firewall is down and TCP listener prints that the container is listening on localhost:8069…

Author

Output of docker port tools:

docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

2ba5aabdf13a odoo:14 "/entrypoint.sh odoo" 19 minutes ago Up 19 minutes 0.0.0.0:8069->8069/tcp, 8071-8072/tcp odoo_14

2e5f033917aa postgres:12 "docker-entrypoint.s…" 19 minutes ago Up 19 minutes 0.0.0.0:5432->5432/tcp postgres_12

wulfert@lnb013:~/odooProjects/Template/docker/odoo14$ docker port odoo_14

8069/tcp -> 0.0.0.0:8069

wulfert@lnb013:~/odooProjects/Template/docker/odoo14$ docker port odoo_14 8069/tcp

0.0.0.0:8069