/docker-mysql-client

Docker container with MySQL client

Primary LanguageMakefileMIT LicenseMIT

docker-mysql-client

Build Status Layers

Docker container with PostgreSQL Client based on gliderlabs/alpine

Features

PostgreSQL Client 10.1 (docker-mysql-client)

Environment

Variable Default Example
MYSQL_HOST 192.168.1.1
MYSQL_PORT 5432 1235
MYSQL_DATABASE temp mydb
MYSQL_USERNAME mysql myuser
MYSQL_PASSWORD mysql mypass

Build

# clone project
git clone https://github.com/madharjan/docker-mysql-client
cd docker-mysql-client


# build
make

# tests
make run
make test

# clean
make clean

Run

Postgres Server (docker-mysql)

# stop & remove previous instances
docker stop mysql
docker rm mysql
# run container
docker run -d \
  -e MYSQL_PASSWORD=mypass \
  --name mysql \
  madharjan/docker-mysql:5.7

Postgres Client (docker-mysql-client)

# psql console
docker run --rm -it \
  --link mysql:db \
  -e MYSQL_HOST=db \
  -e MYSQL_PASSWORD=mypass \
  madharjan/docker-mysql-client:10.1

# psql script
docker run --rm -it \
  --link mysql:db \
  -e MYSQL_HOST=db \
  -e MYSQL_PASSWORD=mypass \
  madharjan/docker-mysql-client:10.1 \
  -c 'select user from user'

Cleanup

docker stop mysql
docker rm mysql

``