MioYvo / py3-mysqlclient-alpine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py3-mysqlclient-alpine

Install python3 mysql driver mysqlclient on alpine linux.

Usage

First, a mariadb container named my-mariadb is running.

>> docker ps 
d627912ec946    mariadb   "docker-entrypoint..."   6 days ago     Up 6 days     0.0.0.0:3306->3306/tcp     my-mariadb

Run this mysqlclient driver linked with my-mariadb.

docker run -it --link my-mariadb:mysql py3-mysqlclient-alpine python

Python 3.6.1 (default, Jun 19 2017, 23:58:41)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>> MySQLdb.connect(host="mysql", user="YOUR USER", passwd="YOUR PASSWORD", db="YOUR DATABASE NAME")
<_mysql.connection open to 'mysql' at 55f032a2bbb8>

In most cases, you will build your own image based on this.

About


Languages

Language:Python 99.3%Language:Dockerfile 0.7%