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.

  • How to get ENV variable when doing Docker Inspect
  • Docker unable to mount volume with node app
  • /bin/sh: 1: composer: not found
  • Mounting nginx conf as a docker volume causes system error boot2docker
  • Can't run a docker container on kubernetes in the interactive mode
  • Error response from daemon: No such image: ubuntu (tag: latest) right after after pulling from docker hub
  • 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?


  • Unable to SSH to a docker container from docker host
  • REST request across networks
  • net_adm:ping from one container to another
  • running bazel remote executor test on separate machines
  • Why does the path command doesn't work in Docker file
  • Exposing a Docker container port
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.