Foundationdb as service container issue

I’m trying to setup a drone build to use foundationdb 5.2.5 as a service container, but I’m getting this error.

/var/fdb/.fdbenv: line 2: 192.168.192.2: command not found
Starting FDB server on 172.17.0.4:4500
Invalid cluster file `/var/fdb/fdb.cluster': 2104 Connection string invalid
Error: Connection string invalid

If I try to start a container from the same image on the drone build agent instance, it starts without error. What is drone doing different when starting a container than when I do it as a regular user, which might have this affect?

My .drone.yaml file:

  2 path: /drone/src/github.com/${DRONE_REPO}/${DRONE_BUILD_NUMBER}
  3
  4 pipeline:
  9   build_and_test:
 10     image: us.gcr.io/projectx/projectx-build-debian:9.4
 12     pull: true
 13     commands:
 14       - sleep 15
 15       - ./gradlew build test
 16     when:
 17       status: [success]
 18       event: tag
 19
 41
 42 # Foundation DB Service Container.  Available for connections at hostname: fdb
 43 services:
 44   fdb:
 45     image: foundationdb/foundationdb:5.2.5

I found the problem with the service container. It uses some scripts to detect the IP address of the system it’s running on to generate a config file, and when running in drone /etc/hosts contains two IP’s for the same hostname. The script was only written expecting a single match. I’m not quite sure why the drone version of the same container has multiple IP’s though. I’m also not sure which one should be used to serve foundation db on for the build container to connect to. Perhaps it doesn’t matter?

Content of etc/hosts

127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters
172.17.0.3	2311108acaf7
172.20.0.2	2311108acaf7

The /etc/hosts file is created by Docker so I can only speculate, but my guess is that docker creates one IP address for the container name (2311108acaf7) and one for the container alias (fdb) [1]. If you docker inspect you would see both aliases listed under networks.

"Aliases": [
  "fdb",
  "2311108acaf7"
],

If there is a way to improve how we handle services I am certainly open to feedback and/or patches. You can see our Docker implementation here.

[1] https://docs.docker.com/engine/reference/commandline/network_connect/#create-a-network-alias-for-a-container