Search code examples
pythondockerodooodoo-12

How to extend base odoo docker image correctly with additional pip packages?


I need to extend basic odoo image installing some python packages. I have a problem related specifically to the odoo docker image.

I've tried writing my own Dockerfile that inherits odoo:latest and install my pip packages over it and it didn't work for me. The thing is everything seems to work just fine during the build stage, but i can't see my module in the pip list output.

Here is my Dockerfile

FROM odoo:latest

RUN pip3 install remote-pdb

I've built my image with that command

docker build -f Dockerfile-odoo -t odoo-extended .

and had the next output

Sending build context to Docker daemon  2.993GB
Step 1/2 : FROM odoo:latest
 ---> 027465548874
Step 2/2 : RUN pip3 install remote-pdb
 ---> Running in ce7e075dacf4
Collecting remote-pdb
  Downloading https://files.pythonhosted.org/packages/72/4d/976e45067b791c0012ee060ba615a95122ba4152dce2cf5d4f57847eef84/remote_pdb-2.0.0-py2.py3-none-any.whl
Installing collected packages: remote-pdb
Successfully installed remote-pdb-2.0.0
Removing intermediate container ce7e075dacf4
 ---> 9e315e30ccbb
Successfully built 9e315e30ccbb
Successfully tagged odoo-extended:latest

Running container with my new image like that docker run -it --rm odoo-extended bash and trying to pip3 list has not show my remote-pdb

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
argh (0.26.2)
Babel (2.3.4)
beautifulsoup4 (4.5.3)
chardet (2.3.0)
decorator (4.0.11)
docopt (0.6.2)
docutils (0.13.1)
feedparser (5.1.3)
gevent (1.1.2)
greenlet (0.4.11)
html2text (2016.9.19)
Jinja2 (2.8)
libsass (0.12.3)
lxml (3.7.1)
Mako (1.0.6)
MarkupSafe (0.23)
mock (2.0.0)
num2words (0.5.10)
odoo (12.0.post20190816)
ofxparse (0.14)
passlib (1.7.0.post20170423015548)
pathtools (0.1.2)
pbr (1.10.0)
Pillow (4.0.0)
pip (9.0.1)
psutil (5.0.1)
psycopg2 (2.7.6.1)
pydot (1.0.29)
pyldap (2.4.25.1)
pyparsing (2.1.10)
PyPDF2 (1.26.0)
pyserial (3.2.1)
python-dateutil (2.5.3)
python-stdnum (1.5)
pytz (2016.7)
pyusb (1.0.0)
PyYAML (3.12)
qrcode (5.3)
reportlab (3.3.0)
requests (2.12.4)
roman (2.0.0)
setuptools (33.1.1)
six (1.10.0)
suds-jurko (0.7.dev0)
urllib3 (1.19.1)
vatnumber (1.2)
vobject (0.9.3)
watchdog (0.8.3)
Werkzeug (0.11.15)
XlsxWriter (0.9.6)
xlwt (1.3.0)

I expected module to be installed and I have no clue why I can't see it. It worked just fine extending other images. Any thoughts?


Solution

  • Seems like the docker base image user is odoo. try this

    FROM odoo:latest
    user root
    RUN pip3 install remote-pdb
    user odoo
    

    then run and verify

    docker run -it --rm odoo-extended bash -c "pip3 list | grep remote-pdb"