Unable to connect to remote MySQL from a docker on Ubuntu Desktop

After much groping in the dark, I think I may have uncovered an Ubuntu Desktop specific docker issue. Please take note of the following:

  • I work at a large corporation where my laptop is connected to internal network (that houses a remote MySQL db). My laptop runs Ubuntu Desktop OS (v14.04).
  • I can connect to the remote MySQL server (using mysql -u<username> -p<password> -h<host>) command from my laptop. I can also telnet to the MySQL server on port 3306 (MySQL server’s default port).

Now, I have a ubuntu:latest docker container running on my laptop where neither of mysql or telnet commands to the said MySQL server work. I initially thought, this may be due to IP forwarding not enabled, so I uncommented line net.ipv4.ip_forward=1 in /etc/sysctl.conf, but to no avail.

  • Docker - Editing Mount Options
  • Docker unable to start
  • TeamCity configuration doesn't persist inside docker
  • docker-credential-osxkeychain wants to use your confidential information
  • REST request from one docker container to another fails
  • Error running kubelet, node not ready
  • Also, note that I do not encounter the same problem on Ubuntu server OS (again, to reiterate, I’m running Ubuntu Desktop OS on my laptop).

    I do not encounter the same problems if I run the docker container on a Mac machine. So, clearly it is something specific to Ubuntu Desktop OS.

    Also, this cannot be related to MySQL privileges since I can connect to the MySQL server from my laptop.

    Would anyone know why this is the case?


  • Application has different appearance when running through docker
  • what does -c means?
  • Alpine based Docker images fully compatible on Ubuntu host?
  • libGL error: failed to load driver swrast in docker container
  • Is it possible to let ansible print each statement?
  • How can I install docker on Debian 8 kernel 2.6.32
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.