2. Víctor S. Recio
CEO NerCore Inc,
@vsrecio
vrecio@nercore.com
Lead
● Docker Santo Domingo
● Linux Dominicana
● Golang Dominicana
● OpenSaturday
Who am I?
3. Demos
Docker
-> $ A Quick Introduction to Docker
-> $ Docker Toolbox
MySQL
-> $ World’s Most Popular Open Source Database
-> $ Industry Leaders Rely on MySQL
-> $ MySQL Enterprise Edition
-> $ MySQL Community Server
Setting a MySQL Container
-> $ Environment Variables
-> $ Starting a MySQL instance
-> $ Data Container
Agenda
8. MySQL
World’s Most Popular Open Source Database
● Over 25 million estimated installations
● Over 10M of pulls in hub.docker.com 5M more than PostgreSQL
● Used by 8 of top 10 web sites in the world
● Embedded by 8 of the top 10 ISVs
● #1 database in the Cloud
● Integrated w/Hadoop in 80% of Big Data platforms
10. MySQL Enterprise Edition
MySQL
MySQL Enterprise Edition includes the most comprehensive set of advanced
features, management tools and technical support to achieve the highest levels of
MySQL scalability, security, reliability, and uptime.
● MySQL Database
● MySQL Enterprise Backup
● MySQL Enterprise High Availability
● MySQL Enterprise Scalability
● MySQL Enterprise Authentication
● MySQL Enterprise Encryption
● MySQL Enterprise Firewall
● MySQL Enterprise Audit
● MySQL Enterprise Monitor
● Enterprise Manager for MySQL
● MySQL Query Analyzer
● 225+ MySQL Advisors
● 600+ Monitored Variables
● 60+ Performance Graphs
● MySQL Workbench
● Oracle Premier Support
11. MySQL Community Server
MySQL
● MySQL Community Server (GPL)
● MySQL Cluster (GPL)
● MySQL Fabric (GPL)
● MySQL Router (GPL)
● MySQL Utilities (GPL)
● MySQL Workbench (GPL)
● MySQL Connectors
MySQL Community Edition is a freely downloadable version of the world's most
popular open source database that is supported by an active community of open
source developers and enthusiasts.
12. Setting a MySQL Container
When you start the MySQL image, you can adjust the configuration of the
MySQL instance by passing one or more environment variables on the
docker run command line.
MYSQL_ROOT_PASSWORD
MYSQL_RANDOM_ROOT_PASSWORD
MYSQL_DATABASE
MYSQL_USER
MYSQL_PASSWORD
MYSQL_ALLOW_EMPTY_PASSWORD
MYSQL_HOST
MYSQL_TCP_PORT
13. FROM oraclelinux:latest
ENV PACKAGE_URL https://repo.mysql.com/yum/mysql-5.7-
community/docker/x86_64/mysql-community-server-minimal-5.7.11-1.
el7.x86_64.rpm
# Install server
RUN rpmkeys --import http://repo.mysql.com/RPM-GPG-KEY-mysql
&& yum install -y $PACKAGE_URL
&& yum install -y libpwquality
&& rm -rf /var/cache/yum/*
RUN mkdir /docker-entrypoint-initdb.d
VOLUME /var/lib/mysql
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 3306
CMD ["mysqld"]
Starting a MySQL instance
Dockerfile
14. docker
run
--detach
--env MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
--env MYSQL_USER=${MYSQL_USER}
--env MYSQL_PASSWORD=${MYSQL_PASSWORD}
--env MYSQL_DATABASE=${MYSQL_DATABASE}
--name ${MYSQL_CONTAINER_NAME}
--publish 3306:3306
mysql:5.7;
Starting a MySQL instance
Docker run
15. Data Container
A common practice is to create a data container -- container whose sole purpose
is to share data between other container. The main benefit of this approach is
tha it provides a handy namespaces for volumenes that can be easily loaded
using --volumes-from command.
$ docker run --name dbdata mysql echo “Data-only container for MySQL”
$ docker run -d --volumenes-from dbdata --name db1 mysql