Connected to my first running container. Yay!

After building a r-pi MySQL Docker image, I needed to figure out how to connect to it. This turns out to be a simple matter of running the following command,

# docker run -p 33060:3306 --rm -t -i mysql-jur/mysql:5.5.43 bash
root@89594fa99e7e:/# service mysql start
[ ok ] Starting MySQL database server: mysqld . . . . . . ..
[info] Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly..
root@89594fa99e7e:/# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.5.43-0+deb7u1 (Debian)
...
mysql> create database test;

And from this point I can create databases in the normal way.

Adding ‘-p 33060:3306’ to the command proxies the database connection to the docker server’s docker0 NIC although the port is only available on IPv6 and the iptables rules are for a different address to that of the NIC. More to investigate.

Next on the list is getting the database created automatically in the container so that we can reference it from a WordPress image. Pleased that I’m making progress.

References

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s