docker icon indicating copy to clipboard operation
docker copied to clipboard

docker image v14, cannot attach 2 volumes to persist data

Open chungenhung opened this issue 5 years ago • 5 comments

Using Ubuntu 20.04.1. Latest docker images for odoo and postgres.

I run postgres in a separate container. This code run fine: sudo docker run -v $HOME/docker_data/odoo/etc/odoo:/etc/odoo -p 8069:8069 --name odoo --link postgres:postgres -t odoo

The above only have -v pointing to the location of odoo.conf file.

BUT, to save the product images uploaded, I believe I need to also map docker container /var/lib/odoo to the host. So now I have this: sudo docker run -v $HOME/docker_data/odoo/etc/odoo:/etc/odoo -v $HOME/docker_data/odoo/var/lib/odoo:/var/lib/odoo -p 8069:8069 --name odoo --link postgres:postgres -t odoo

Docker will run, but will get stuck at: odoo.service.server: HTTP service (werkzeug) running on xxxx:8069

Then, if I try to access the webpage, the docker log will show: odoo.http: HTTP Configuring static files

And it just stuck there forever. I have checked to make sure $HOME/docker_data/odoo/var/lib/odoo directory exists on the host machine.

chungenhung avatar Oct 06 '20 08:10 chungenhung

I think you need to: chown -R 101:101 'filestore' && chmod -R 750 'filestore'

Here's a copy of my odoo.yml - It hasn't failed me yet.

version: '3'

services: app: image: odoo:latest command: odoo -u all -d odoo ports: - "8069:8069" - "8072:8072" volumes: - ./app/data:/var/lib/odoo - ./app/addons:/mnt/extra-addons environment: TZ: America/Los_Angeles deploy: replicas: 1

db: image: postgres:12-alpine ports: - "5432:5432" volumes: - ./app/db:/var/lib/postgresql/data/pgdata environment: POSTGRES_DB: postgres POSTGRES_USER: odoo POSTGRES_PASSWORD: odoo PGDATA: /var/lib/postgresql/data/pgdata deploy: replicas: 1

sbouillon avatar Oct 07 '20 06:10 sbouillon

Thanks sbouillon. I would use yml, but cannot ever figure out how to make it connect to an existing postgres docker container. Do you know how? The script you have above will spin up a new postgre docker container right?

chungenhung avatar Oct 07 '20 08:10 chungenhung

Are you using swarm or compose? If you’re using compose then the host name will be “db” if you structure it the same as I posted.

If you open the ports like I reflected above then you can use the host IP address in your odoo.conf

If you have an existing Postgres container then use the host IP address to connect your Odoo container - or put both services on the same yml and they will communicate flawlessly.

Let me know if you need further help with that. It’s too simple not to do it. I understand if it’s hard to figure out the config though. Once it “clicks” it will become really easy in the future.

On Wed, Oct 7, 2020 at 1:33 AM chungenhung [email protected] wrote:

Thanks sbouillon. I would use yml, but cannot ever figure out how to make it connect to an existing postgres docker container. Do you know how? The script you have above will spin up a new postgre docker container right?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/odoo/docker/issues/325#issuecomment-704782615, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJB2TDGBVPKL5AJJDVAPWKTSJQRVRANCNFSM4SFVY5MQ .

sbouillon avatar Oct 07 '20 08:10 sbouillon

I am using docker compose command.

The first post above, I was using odoo.conf in $HOME/docker_data/odoo/etc/odoo . I do not know how to use odoo.conf with the yml.

my postgres docker container is simply named "postgres".

"put both services on the same yml and they will communicate flawlessly." Then when you stop odoo, wouldn't it also stop the postgres database? The reason I have a separate postgres container is b/c I use the same database for other things, and must be on regardless of odoo status. I rather keep it separate, especially now that I am not that good with docker yet.

I'll try it out later then report back. Appreciate the help!

chungenhung avatar Oct 07 '20 08:10 chungenhung

@chungenhung any updates on this or can you close this issue?

lathama avatar Apr 02 '24 20:04 lathama