Running docker with an existing volume

Viewed 569

Need a bit of a help to restore my Odoo instance post image update. I think it probably is gone now but wondering if I can restore it.

I did a mistake of doing the following when upgrading my Odoo instance:

  1. docker pull image
  2. docker stop instance
  3. docker rm instance
  4. docker-compose up -d

Now, I just realized that I shouldn't did this method according to their Dockerhub page - this is what should've done.

$ docker run --volumes-from old-odoo -p 8070:8069 --name new-odoo --link db:db -t odoo

Hoping to be able to re-run my instance, I've tried the following to no luck - it feels like I'm not mounting the old volume properly.

docker run --mount source=85e806e42968fb5ee30556ecd559420fd2f745af85aab921d64664414304317a ,target=/_data --expose 8069 --expose 80 --expose 443 --name odoo_web_1 --network nginx-proxy --link odoo_db_1:db -t odoo

I run into error 503 page when i try to access the site.. :( I'm not sure if I should be using --mount or --volume to access the previously mounted volume.

I do use docker-compose and if the volume mounting is something that can be done through docker-compose, that would work best.

Or, should I just start a new instance and migrate the old database to the new one?

docker-compose.yml is as below

version: '2'
services:
  web:
    image: odoo:latest
    depends_on:
      - db
    expose:
      - "80"
      - "443"
    environment:
      VIRTUAL_PORT: 8069
      VIRTUAL_HOST: sub.domain.com
      LETSENCRYPT_HOST: sub.domain.com
      LETSENCRYPT_EMAIL: admin@domain.com
    volumes:
      - ./openerp-server.conf:/etc/openerp-server.conf
      - ./addons:/mnt/extra-addons
  db:
    image: postgres:latest
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=xxx
      - POSTGRES_USER=xxx

networks:
  default:
    external:
      name: nginx-proxy

1 Answers

You have not mounted your data volume (/var/lib/odoo) so your data files has been gone with the instance. The volumes you have mounted are for addons and config file and they are not different between your old and new image.

add this to your docker compose for the next time :) :

volumes:
      - ./openerp-server.conf:/etc/openerp-server.conf
      - ./addons:/mnt/extra-addons
      - odoo14:/var/lib/odoo

you can mount to a folder as well.

Related