split off the part of the script that sets up xos from that part that starts the UI
diff --git a/xos/scripts/docker_setup_xos b/xos/scripts/docker_setup_xos
new file mode 100755
index 0000000..2ebd099
--- /dev/null
+++ b/xos/scripts/docker_setup_xos
@@ -0,0 +1,18 @@
+#! /bin/bash
+
+function wait_postgres {
+    sudo -u postgres psql -c '\q'
+    while [[ "$?" != "0" ]]; do
+        echo Waiting for postgres to start
+        sleep 1
+        sudo -u postgres psql -c '\q'
+    done
+}
+
+cd /tmp
+service postgresql start
+wait_postgres
+service supervisor start
+cd /opt/xos
+PUBLIC_HOSTNAME=`./xos-config.py get server_hostname $HOSTNAME`
+python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure
diff --git a/xos/scripts/docker_start_xos b/xos/scripts/docker_start_xos
index 2ebd099..eee9b8f 100755
--- a/xos/scripts/docker_start_xos
+++ b/xos/scripts/docker_start_xos
@@ -1,18 +1,7 @@
 #! /bin/bash
 
-function wait_postgres {
-    sudo -u postgres psql -c '\q'
-    while [[ "$?" != "0" ]]; do
-        echo Waiting for postgres to start
-        sleep 1
-        sudo -u postgres psql -c '\q'
-    done
-}
+bash /opt/xos/scripts/docker_setup_xos
 
-cd /tmp
-service postgresql start
-wait_postgres
-service supervisor start
 cd /opt/xos
 PUBLIC_HOSTNAME=`./xos-config.py get server_hostname $HOSTNAME`
 python manage.py runserver $PUBLIC_HOSTNAME:8000 --insecure