2

I am new with Docker. I downloaded images and started container with a command

docker-compose up -d

I have a container configuration file:

    algotrader:
  image: algotrader/algotrader
  command: -i
  links:
    - mysql
    - ibgateway
  ports:
    - 9090:9090
    - 61614:61614

ibgateway:
  image: algotrader/ibgateway
  environment:
    TWS_USERNAME: edemo
    TWS_PASSWORD: demouser
  volumes:
    - /var/lib/tws

mysql:
  image: mysql
  environment:
    MYSQL_ROOT_PASSWORD: password
    MYSQL_DATABASE: algotrader
  ports:
    - 3306:3306
  volumes:
    - /var/lib/mysql

When I run command

docker ps

it shows me the list of apps running in Docker container:

c:\Program Files\Docker\Docker\resources>docker ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
1e7fe9da1ad7        algotrader/algotrader   "bin/docker-run.sh -i"   28 hours ago        Up About an hour    10.0.75.2:9090->9090/tcp, 10.0.75.2:61614->61614/tcp   docker_algotrader_1
72fe4fd2bfb8        algotrader/ibgateway    "/usr/local/ibgateway"   28 hours ago        Up About an hour    4001/tcp                                               docker_ibgateway_1
3b739113b4e9        mysql                   "docker-entrypoint.sh"   28 hours ago        Up About an hour    10.0.75.2:3306->3306/tcp                               docker_mysql_1
c367f3dca162        algotrader/ibgateway    "/usr/local/ibgateway"   28 hours ago        Up 26 minutes       4001/tcp                                               resources_ibgateway_1

But when I run command to get IP address:

docker-machine ls

It shows me empty list of machines:

c:\Program Files\Docker\Docker\resources>docker-machine ls
NAME   ACTIVE   DRIVER   STATE   URL   SWARM   DOCKER   ERRORS

Also I am able to connect to bash on that container:

docker exec -it 1e7fe9da1ad7 bash

Inside container ping to IP address 172.17.0.4 is working, but not from Windows:

root@1e7fe9da1ad7:/usr/local/algotrader# ping 172.17.0.4
PING 172.17.0.4 (172.17.0.4): 56 data bytes
64 bytes from 172.17.0.4: icmp_seq=0 ttl=64 time=0.055 ms

By documentation it should be able to connect to port 9090, but from Windows this address is not available.

Do you know how to get proper address or check is it closed to outside(Windows)?

Thank You!

migAlex
  • 273
  • 3
  • 16

2 Answers2

0

From Windows, you need the IP of the VM (docker-machine ip <yourMachine> or the Hyper-V one)
See "How do I configure docker compose to expose ports correctly?" as an example when using VirtualBox.

Then you need to port-forward 9090 to your Windows host in order to access that port directly from Windows.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

I just reinstalled Docker Tools on Windows from scratch. And it began to work.

migAlex
  • 273
  • 3
  • 16