Install python3 mysql driver mysqlclient on alpine linux (just 101 MB).
1.9K
Install python3 mysql driver mysqlclient on alpine linux.
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>
--link https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/#communication-across-linksIn most cases, you will build your own image based on this.
Content type
Image
Digest
Size
36.4 MB
Last updated
over 5 years ago
docker pull mio101/py3-mysqlclient-alpine