diff --git a/lib/kamal/cli/templates/sample_hooks/docker-setup.sample b/lib/kamal/cli/templates/sample_hooks/docker-setup.sample index ce263fffe..d914913d5 100755 --- a/lib/kamal/cli/templates/sample_hooks/docker-setup.sample +++ b/lib/kamal/cli/templates/sample_hooks/docker-setup.sample @@ -1,7 +1,13 @@ -#!/bin/sh +#!/usr/bin/env ruby # A sample docker-setup hook # -# Sets up a Docker network which can then be used by the application’s containers +# Sets up a Docker network on defined hosts which can then be used by the application’s containers -ssh user@example.com docker network create kamal +hosts = ENV["KAMAL_HOSTS"].split(",") + +hosts.each do |ip| + destination = "root@#{ip}" + puts "Creating a Docker network \"kamal\" on #{destination}" + `ssh #{destination} docker network create kamal` +end