0

I'm just getting started with Docker, so I decided I'd try to create a simple flask API app.

The problem is, I keep getting various errors depending on what I try to do to fix them.

My requirements.txt:

Flask
MySQL-python
bleach
bcrypt

My Dockerfile:

FROM ubuntu:latest
MAINTAINER Caleb Hester "[email protected]"
ENV LANG C.UTF-8
RUN apt-get update -y
RUN apt-get install -y python-pip python-dev build-essential
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python2.7"]
CMD ["api.py"]

I get this error: EnvironmentError: mysql_config not found

I tried a few things, including adding a apt-get -y build-dep python-mysqldb, but when I do that, I get an error about needing to add some URIs to my sources.list, and something about locales and C.UTF-8.

I'm very confused here.

Does anyone know what the proper docker file would be?

UPDATE:

After adding libmysqlclient-dev to my apt-get install, the MySQLdb error goes away, but now I'm getting this error for cffi:

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-JrzOzV/python2.7-2.7.15~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
              ^~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

Update:

I fixed this by adding libffi-dev to my apt-get install

1 Answer 1

1

You might be missing the mysql deb package.

Try appending libmysqlclient-dev to the line

RUN apt-get install -y python-pip python-dev build-essential

so that you now have

RUN apt-get install -y python-pip python-dev build-essential libmysqlclient-dev
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! That got rid of the first error, but now I get this: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
@CalebH. not sure of the reason for that - might be better to ask that as a separate question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.