Ensure ports is an array before passing to docker-py