Containers are not linked with docker-compose version 2
Add an environment variable to your ff
section of the Docker Compose file (and you can remove the link):
ff:
container_name: ff
image: selenium/node-firefox
environment:
- HUB_PORT_4444_TCP_ADDR=hub
expose:
- "5555"
Compose version 2 uses a different style of networking. From the upgrading guide:
environment variables created by
links
have been deprecated for some time. In the new Docker network system, they have been removed. You should either connect directly to the appropriate hostname or set the relevant environment variable yourself, using the link hostname.
From the networking documentation:
links
are not required to enable services to communicate - by default, any service can reach any other service at that service’s name.
The Selenium dockerfile uses version 1 style networking by ENV variable. Here in the code, if that variable isn't set (which Docker used to do) the entry_point.sh command exits. Providing the variable explicitly solves this.