#!/bin/sh

/usr/sbin/update-ca-certificates

# Start docker-dind
/usr/local/bin/dockerd-entrypoint.sh dockerd > ./daemon-local.log 2>&1 &

while ! /usr/bin/gosu harbor /usr/bin/docker ps &> /dev/null; do
  echo "Waiting for docker to start..."
  sleep 5
done

# Enable the harbor user to run ctr commands
chown -R root:harbor /run/containerd/containerd.sock

exec /usr/bin/gosu harbor /usr/local/bin/run-harbor-tests.sh
