I have docker container running in localhost. And inside this container I have created one python script to access one endpoint which is from another server. After executing docker-compose exec server bash command, I will be inside the container. I could not access this endpoint inside the container. When I try curl command to check, it returns connection timed out error.
For the same endpoint, if I try it anywhere outside container, it works.
version: "3.2"
services:
server:
image: image1
build: ./docker/
environment:
L_PASSWORD: "password"
L_LICENSE_FILE: "/opt/l7esp/project/conf/esp.license"
ports:
- published: 8002
target: 8002
protocol: tcp
mode: host
- published: 8003
target: 1487
protocol: tcp
mode: host
volumes:
- type: bind
source: .
target: /opt/l/project
- type: volume
source: data
target: /opt/l/data
- type: volume
source: static
target: /opt/l/server/lib/www/static
volumes:
data: {}
static: {}
This is the docker-compose.yml file that I am using. Is this anything needs to be done so that I can access the external endpoint inside the docker container?
Has anyone gone through the similar issues and resolved? Kindly guide me