diff --git a/backup/Dockerfile b/backup/Dockerfile
index 4adec44f8a06a33d9288206fcdb11bef1081f914..481aeaad068ab482f10a064362a7ede7a33a2c77 100644
--- a/backup/Dockerfile
+++ b/backup/Dockerfile
@@ -5,5 +5,6 @@ RUN yum install -y cronie epel-release openssh-clients postgresql12
 RUN yum install -y borgbackup
 ADD entrypoint.sh /usr/local/bin/entrypoint.sh
 ADD do_backup.sh /usr/local/bin/do_backup.sh
+ADD init_repo.sh /usr/local/bin/init_repo.sh
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 CMD ["tail", "-f", "/var/log/borg"]
diff --git a/backup/entrypoint.sh b/backup/entrypoint.sh
index a238ba55a5bb16320a1c2db3829e36110f0c6f8c..38d1a714d9567ba8787d5da06e469544bd8fc893 100755
--- a/backup/entrypoint.sh
+++ b/backup/entrypoint.sh
@@ -19,8 +19,13 @@ echo "${SSH_ID}" | sed -e 's/\\n/\n/g' > /etc/borg/id_rsa
 chmod 400 /etc/borg/id_rsa
 
 if ! borg info &> /dev/null; then
-  echo "Repository not ready. Initializing repo."
-  borg init -e repokey
+  echo "Repository not ready. Please run:"
+  echo "  docker-compose exec backup /usr/local/bin/init_repo.sh"
+
+  while ! borg info &> /dev/null; do
+    sleep 10;
+  done
+
   echo " ... ready"
 fi
 
diff --git a/backup/init_repo.sh b/backup/init_repo.sh
new file mode 100755
index 0000000000000000000000000000000000000000..ff2d5403da1c9f851be5cd17fa8066d52fa7b9fd
--- /dev/null
+++ b/backup/init_repo.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+borg init -e repokey
+