Attempt the SSH installation into the Docker container up to 3 times instead of destroying the container and creating a new one. The container or the container's ssh daemon may not be up at first.