6

So my ultimate end goal is to run a MySQL Docker container (say tutum/mysql from the public registry) and then link a Gitlab Docker container (say sameersbn/gitlab) to it where both containers use persistent storage.

However, I am stuck on the MySQL part. Every time I try and run a pre-made MySQL Docker container (mysql, tutum/mysql and sameersbn/mysql) as outlined below, I get the below output.

Steps

This is just one way of getting to the error message below.

  1. docker.io pull tutum/mysql:latest
  2. docker.io run -it tutum/mysql bash
  3. Once attached to the new container run "/run.sh" (as per tutum/mysql dockerfile)
  4. At this point a "Waiting for confirmation of MySQL service startup" message constantly repeats.
  5. At this point if I cancel the "/run.sh" command and start MySQL myself I get the error message below.

Output:

root@1bbeb34f3491:/# mysqld

140730 4:49:04 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.

140730 4:49:04 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.

140730 4:49:04 [Note] Plugin 'FEDERATED' is disabled.

mysqld: Table 'mysql.plugin' doesn't exist

140730 4:49:04 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

140730 4:49:04 InnoDB: The InnoDB memory heap is disabled

140730 4:49:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins

140730 4:49:04 InnoDB: Compressed tables use zlib 1.2.8

140730 4:49:04 InnoDB: Using Linux native AIO

140730 4:49:04 InnoDB: Initializing buffer pool, size = 128.0M

140730 4:49:04 InnoDB: Completed initialization of buffer pool

140730 4:49:04 InnoDB: highest supported file format is Barracuda.

140730 4:49:04 InnoDB: Waiting for the background threads to start

140730 4:49:05 InnoDB: 5.5.37 started; log sequence number 1595675

140730 4:49:05 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306

140730 4:49:05 [Note] - '0.0.0.0' resolves to '0.0.0.0';

140730 4:49:05 [Note] Server socket created on IP: '0.0.0.0'.

140730 4:49:05 [ERROR] Can't start server : Bind on unix socket: Permission denied

140730 4:49:05 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?

140730 4:49:05 [ERROR] Aborting

140730 4:49:05 InnoDB: Starting shutdown... 140730 4:49:06 InnoDB: Shutdown completed; log sequence number 1595675 140730 4:49:06 [Note] mysqld: Shutdown complete

Addressing the errors

  • "Please run mysql_upgrade to create it" => run mysql_upgrade command which outputs

root@1bbeb34f3491:/# mysql_upgrade

Looking for 'mysql' as: mysql

Looking for 'mysqlcheck' as: mysqlcheck

FATAL ERROR: Upgrade failed

  • "Do you already have another mysqld server running on socket" => Nope. Running service mysql stop does nothing and running ps doesn't show mysqld. Running ls -a /var/run/mysqld/ suggests that the socket file doesn't exist.

No matter which MySQL container I try, eventually when I start MySQL the same error message came up. This almost certainly means there is something wrong with my setup which confuses me because I thought a Docker container, with no exposed ports or persistent storage, would be isolated from the system Docker is installed on?

I have also tried running a MySQL container with the -d flag then running a fresh ubuntu 14.04 container (docker.io run -it --link mysql:mysql ubuntu:14.04 bash) linked to it. On the Ubuntu container I installed mysql-client through apt-get and tried to connect to the MySQL container but that doesn't work either.

My host system is running Ubuntu 14.04 and Docker was installed through apt-get and is version 0.9.1.

I wasn't quite sure what to put in this explanation because the problem seems quite weird to me. If there is anything I have missed please ask and I will add it for you.

Thanks, JamesStewy

EDIT If someone could create a set of instructions that creates one MySQL container and one linked container and works for them so I can give it a go.

2

With sameersbn/mysql

I don't believe you can run it interactively.

docker run --name mysql -d sameersbn/mysql:latest

So you simply run it as a daemon, inspect the container to find the IP address like so:

docker inspect mysql | grep IPAddres

and then you can connect to mysql on that IP.

  • 1
    When I run the first command to start the MySQL container it immediately exits: "a6c27d6be94e sameersbn/mysql:latest /start 3 minutes ago Exit 1" – JamesStewy Jul 30 '14 at 22:16
  • 1
    When I run "docker.io run --name mysql -d tutum/mysql:latest" it does not exit and "docker.io inspect mysql | grep IPAddress" returns '"IPAddress": "172.17.0.5"'. But when I run "mysql -h 172.17.0.5" it returns with 'ERROR 2003 (HY000): Can't connect to MySQL server on '172.17.0.5' (111)'. – JamesStewy Jul 31 '14 at 2:37
0

We had the same issue - seems you need to wait for mysql to startup (or at least get the start the listeners). Otherwise you'll get the 2013 issue that you got. We just added sleep 60 which is a fairly inelegant hack but seems to work. Would love to hear a better workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.