I need a way to update /etc/hosts or update DNS entries in already started service after the step was started.
kind: pipeline
type: docker
name: default
services:
- name: webdriver
image: selenium/standalone-chrome-debug:3.141.59
steps:
- name: provision
image: ubuntu:bionic
commands:
- ## A SOME WAY TO UPDATE /etc/hosts in WEBDRIVER service before call selenium go to the specific URL
- # For example: add a record to /etc/hosts: <ip_of_the_running_step_container> provision
- name: step2
image: ubuntu:bionic
commands:
- # For example: add a record to /etc/hosts: <ip_of_the_running_step_container> step2
Docker provides an internal DNS service that allows containers on the same user-defined network to communicate by hostname (which Drone sets to the step name). The following is a working example that demonstrates how pipeline steps can communicate with one-another using the step name as the hostname:
kind: pipeline
name: default
steps:
- name: test
image: redis
commands:
- sleep 5
- redis-cli -h cache ping
- redis-cli -h cache set FOO bar
- redis-cli -h cache get FOO
services:
- name: cache
image: redis