Here is the method to have Docker and Docker Compose installed on your Debian 9 system. This is a shortened version of the official one so it can be easily copy/paste.
I have made a small bash script to automate this installation process. You could find it on my Github.
Update the apt index and install the needed packages
apt update apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
Add & check Docker GPG key
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
Check that the correct key have been added
apt-key fingerprint 0EBFCD88
Add the Debian official repository
Add the stable repository for 64bits system
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
Update the apt index once more, and install Docker CE and containerd
apt update apt install docker-ce docker-ce-cli containerd.io
Verify that Docker CE is installed and can run images
docker run hello-world
DOCKER COMPOSE INSTALLATION
What is Docker Compose
Download the Docker Compose binary
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Grant execution privileges on the downloaded binary
chmod +x /usr/local/bin/docker-compose
Check that the binary is working properly