Title: Groovy script from docker container
Tags: curl;docker;groovy
Question: I'm trying to get the html response from my web page using docker and groovy script. Normally I could use curl as below:

```curl 972-254-1311:1410
```

...and get the response "OK"

But when I'm trying to get the same with starting docker and groovy:

```[mycomp@my-host script] cat run.sh
#!/bin/bash
docker run                                                          \
    --rm                                                            \
    -e TZ=Europe/Warsaw                                             \
    -v /home/user1/monitoring/:/home/user1/monitoring/:Z      \
    -w /home/user1/monitoring/script                             \
    --name groovy2 groovy:2.4.11-jdk8                               \
    groovy run.groovy

[mycomp@my-host script] cat run.groovy
def server = "972-254-1311"
println "http://$server:1410/".toURL().text
```

... I'm getting such an Timeout error (after many seconds...):

```[mycomp@my-host script] ./run.sh
Caught: java.net.ConnectException: Connection timed out (Connection timed out)
java.net.ConnectException: Connection timed out (Connection timed out)
        at run.run(run.groovy:2)
```

I don't know what I'm doing wrong. Maybe you can tell me? Maybe you can propose my something other solution (but still using docker and groovy)



EDIT:
Program is ok, I had a problem with connection to this ip address. 

Comment: What is your base image?

Comment: What is the output of command on host machine | docker container ? - `telnet {{PHONE+SOCIAL_SECURITY_NUMBER}}`?

Comment: @Rao: groovy:2.4.11-jdk8

Comment: I guess it might related to network configuration. More or less you need to add you docker container to local network. It also shouldn't work with curl.

Comment: What is this IP for 972-254-1311? what is the network infra?

Comment: Thanks you all for suggestion about infrastructure and telnet'ing this addres. Of course I had an limitiation of network connection. I added some rule and now everything is ok.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 6, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:08/29/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<curl><docker><groovy>', 'Title': 'Groovy script from docker container', 'ViewCount': 1086, 'id': 45942195, 'user_AboutMe': '<p>Java and Android Developer</p>\n', 'user_AccountId': 4447413.0, 'user_DisplayName': 'Rafal Iwaniak', 'user_Reputation': 161.0, 'user_Views': 39.0, 'user_id': 4435290.0}}