I am trying to deploy my python app in a docker container. The application uses pyzbar package for QR decoding.
On a Mac, I use brew install zbar to install the shared libraries and in my requirements file, I have
pypng==0.20220715.0
pyzbar==0.1.9
PyQRCode==1.2.1
I have the following Dockerfile:
FROM python:3.7-slim-buster
RUN apt install python-zbar
the output of the last file is:
ERROR [2/8] RUN apt install python-zbar 0.2s
------
> [2/8] RUN apt install python-zbar:
#5 0.186
#5 0.186 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.186
#5 0.188 Reading package lists...
#5 0.194 Building dependency tree...E: Unable to locate package python-zbar
#5 0.195
#5 0.195 Reading state information...
------
executor failed running [/bin/sh -c apt install python-zbar]: exit code: 100
Does anyone know a Docker Image that will support both?
According to the zbar docs for Linux you need to install
libzbar0first, and then do apip install pyzbar. You can have to following Docker image which does this:A little bit of explanation for
exit code: 100error:This error usually happens when the command, which you are running, is waiting for user input. For
apt-get installyou can pass the-yflag to avoid havingaptto prompt for an user input.