docker container communication in jenkins build

Viewed 21

I have below docker-compose.yml file

freeradius:
 image: freeradius/freeradius-server:latest-alpine
 restart: always
 volumes:
   - ./radius/raddb/users:/etc/raddb/users:ro
   - ./radius/raddb/clients.conf:/etc/raddb/clients.conf:ro
 ports:
   - "1812-1813:1812-1813/udp"
 command: [ "radiusd", "-X", "-t" ] # Debug mode with colour

my-service:
 image: 'my-service:latest'
 container_name: my-service
 ports:
   - '443:443'
 environment:
   # some env variable
 extra_hosts:
   - "host.docker.internal:host-gateway"

So above file runs while integration tests runs, after IT, stops the docker container. From one of the test case, I am calling a class where have below codes to test the AAA server communication

radius.authenticate('secret', username, password, host='freeradius', port=1812))

above authentication works well in my local machine (macOS) but when I start the build from jenkins from our jenkins server, giving me error to connect radius server, I guess in jenkins build host name is not resolving

Any idea why it is happening in Jenkins build, what changes I need to make so in Jenkins build, IT will pass.

0 Answers
Related