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.

  • Kubernetes fails to pull Docker image from artifactoryonline.com
  • Getting logs of tomcat containers running in kubernetes pods using fluentd, elsasticsearch and kibana
  • What is [loop0] process for?
  • How to replicate microservices when consuming same kafka topic?
  • ASP.NET Core app crashing
  • etcd api on CoreOS - setting ip address configurations remotely
  • 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?


  • Mongo doesn't run after installing on Docker Centos image: Failed to connect to
  • What is the difference between Docker Swarm and Kubernetes/Mesophere?
  • Django channels and docker-compose error
  • Deploying latest docker containers with ansible
  • Recommendation: Deploy Docker application to AWS
  • /home/web/.gem/ruby/2.2.0/gems/redis-3.2.1/lib/redis/connection/ruby.rb:152:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError)
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.