Kaveesha Baddage
Kaveesha Baddage

Reputation: 69

An error occured when creating an image using Dockerfile

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?

Upvotes: 0

Views: 106

Answers (1)

Jahongir Rahmonov
Jahongir Rahmonov

Reputation: 13723

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!

Upvotes: 1

Related Questions