How do I run brew command in docker image with From python:3.6 environment?

926 Views Asked by At

I am new to docker. I built a python flask application and now I would like to create a docker image for it. However, in my app, I used python subprocess to execute Calibre command. I installed Calibre on my local machine using brew. Now I wonder how it works with docker under "FROM python:3.6" environment?

Do I simply just append "brew cask install calibre" in my dockerfile? Or I need to configure the homebrew and so on?

Below is my current dockerfile:

FROM python:3.6

ENV FLASK_APP run.py

COPY run.py gunicorn-cfg.py requirements.txt .env ./
COPY app app

RUN pip install -r requirements.txt

EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "run:app"]

Thanks in advance!

1

There are 1 best solutions below

1
On BEST ANSWER

We can see python:3.6 is based on Debian by running:

 docker run -it python:3.6 /bin/bash -c 'cat /etc/*release'

This gives us:

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Debian doesn't come with brew pre-installed, however, it comes with the apt package manager with debian.org repositories, which contain the calibre package:

RUN apt-get update
RUN apt-get install -y calibre