Rails system test with capybara and headless selenium browser in Docker
You have to override the host method so Capybara uses the container's IP address. Check out this post: https://medium.com/@pacuna/using-rails-5-1-system-tests-with-docker-a90c52ed0648