0

I created a Dockerfile to create an image to run web based application. When I running that file and it tries to collect mysqlclient==1.3.7 ,following error is occured.

"mysql_config raise EnvironmentError("%s not found" %(mysql_config.path,))
EnvironmentError: mysql_config not found


Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ME9Fq7/mysqlclient/                                 
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.  "

This is Dockerfile

 ############################################################
 # Dockerfile to build Python WSGI Application Containers
 # Based on Ubuntu
 ############################################################

 # Set the base image to Ubuntu
 FROM ubuntu:latest

 # File Author / Maintainer
 MAINTAINER Brian

 # Add the application resources URL
 #RUN echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -sc) main    universe" >> /etc/apt/sources.list

 # Update the sources list
 RUN apt-get update -y;


 # Install basic applications
 RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential

 # Install Python and Basic Python Tools
 RUN apt-get install -y python python3-dev python-distribute python-pip libssl-dev

 # Copy the application folder inside the container
 ADD /WebApp /WebApp

 #RUN pip install mysql

 # Get pip to download and install requirements:
 RUN pip install -r /WebApp/requirements.txt

 # Expose ports
 EXPOSE 80

 # Set the default directory where CMD will execute
 WORKDIR /WebApp

 # Set the default command to execute    
 # when creating a new container
 # i.e. using CherryPy to serve the application
 CMD ./start.sh

How can I solve this problem?

1 Answer 1

1

I believe that you are trying to install the mysql driver for Python, but you don't have MySQL installed. Try to install MySQL before installing mysql driver:

RUN apt-get install mysql-server

Hope it helps!

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you Jahongir for your suggestion. I added "RUN apt-get install libmysqlclient-dev " .Then it works without any errors.
@KaveeshaBaddage did it help?

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.