title: Access ftp service via other docker container
body: <p>I have a Golang app, and it is supposed to connect to a FTP Server.</p>
  
  <p>Now, both Golang app and FTP Server is dockerized, but I don't know how to connect to FTP server from Golang app</p>
  
  <p>Here is my docker-compose.yml</p>
  
  <pre><code>version: '2'
  
  services:
    myappgo:
      image: myappgo:exp
      volumes:
        - ./volume:/go
      networks:
        myappgo_network:
      env_file:
        - test.env
  
    ftpd-server:
      container_name: ftpd-server
      image: stilliard/pure-ftpd:hardened
      ports:
        - "21:21"
        - "30000-30009:30000-30000"
      environment:
        PUBLICHOST: "localhost"
        FTP_USER_NAME: "test"
        FTP_USER_PASS: "test"
        FTP_USER_HOME: "/home/test"
      restart: on-failure
      networks:
        myappgo_network:
  
  networks:
    myappgo_network:
  </code></pre>
  
  <p>When I run docker compose, all services are up.</p>
  
  <p>I could get IP of ftp container with:</p>
  
  <pre><code>docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ftpd-server
  </code></pre>
  
  <p>And then, I installed a ftp client for alpine in my golang container, lftp:</p>
  
  <pre><code>docker exec -it my_app_go sh
  apk add lftp
  lftp -d ftp://test:test@172.19.0.2 # -d for debug
  lftp test@172.19.0.2:~&gt; ls
  ---- Connecting to 172.19.0.2 (172.19.0.2) port 21
  `ls' at 0 [Connecting...]
  </code></pre>
  
  <p>What am I missing ?</p>