Expand on docker-setup.sample script so it creates docker network "kamal" on each of the defined hosts.

This commit is contained in:
Cezary Kłos
2024-06-24 12:45:56 +02:00
parent ff03891d47
commit 9e12d32cc3

View File

@@ -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 applications containers
# Sets up a Docker network on defined hosts which can then be used by the applications 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