Docker – Not able to telnet Linked Container

I have a container A with Dockerfile as follows:

FROM ubuntu:latest
MAINTAINER arpitaggarwal ""

and another container B with Dockerfile as follows:

  • install nvm in docker
  • Application takes different amount of memory on different systems
  • install java successfully using the dockerfile however its says java command not found
  • Importing a python module in Jython StreamSets - ImportError: No module named
  • Docker inter container communication not working
  • creating a default database in mysql using dockerfile
  • ...
    FROM ubuntu:latest
    MAINTAINER arpitaggarwal ""
    RUN apt-get install -q -y mysql-server
    EXPOSE 3306

    Then I started the container B using command:

    docker run -P -it --name db B /bin/bash

    And running the command: docker run --rm --name web --link db A env

    gives me below output:


    Then I logged into container A and run the command: ping db

    which gives me output:

    PING db ( 56(84) bytes of data.
    64 bytes from db ( icmp_seq=1 ttl=64 time=0.082 ms
    64 bytes from db ( icmp_seq=2 ttl=64 time=0.063 ms
    64 bytes from db ( icmp_seq=3 ttl=64 time=0.065 ms
    64 bytes from db ( icmp_seq=4 ttl=64 time=0.061 ms
    64 bytes from db ( icmp_seq=5 ttl=64 time=0.066 ms

    And when I tried telnet command with port 3306, as follows:

    telnet 3306

    gives me output:

    root@9b078c1fed82:/# telnet 3306
    telnet: Unable to connect to remote host: Connection refused

    Any idea, how can I telnet linked container?

    Any help will be appreciated!

  • What is the file-system of a Docker container? On which file system does an application running inside this container runs on?
  • getting JsonMappingException with latest spotify docker-client
  • deploy docker container on AWS EC2 instance without being logged in
  • Docker compose and REST config
  • How to know which docker image I am using here?
  • Docker cannot run hello-world from client
  • 2 Solutions collect form web for “Docker – Not able to telnet Linked Container”

    MySQL usually only listens on by default. You need to modify the my.cnf during build and set bind-address to You could accomplish this with something like:

    RUN sed -i -e"s/^bind-address\s*=\s* =" /etc/mysql/my.cnf

    After receiving the answer by @Andy Shinn, I Updated the container B Dockerfile as below:

    FROM ubuntu:latest
    MAINTAINER arpitaggarwal ""
    RUN apt-get install -q -y mysql-server
    RUN apt-get install -q -y mysql-client
    RUN sed -i -e"s/^bind-address\s*=\s* =" /etc/mysql/my.cnf
    EXPOSE 3306

    And when I tried accessing mysql-server from container A as:

    mysql -u root -ppassword -h

    Gives me error:

    ERROR 1130 (HY000): Host '' is not allowed to connect to this MySQL server

    Which I figured it out is because container A was trying to connect to db container through root user. But In mysql do not allow you to connect though root user remotely. So I work around creating another user in mysql-server with root privileges.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.