May 22, 2021 Docker From entry to practice
MySQL is an open source relationship database implementation. The repository provides mirror images of various versions of MySQL, including the 5.6 Series, the 5.7 Series, and more.
The database is
3306
by default.
$ sudo docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=mysecretpassword -d mysql
You can then connect to the container using other apps.
$ sudo docker run --name some-app --link some-mysql:mysql -d application-that-uses-mysql
Or through
mysql
$ sudo docker run -it --link some-mysql:mysql --rm mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'