After setting up a new Ubuntu Linux VM and logging in for the first time, copy/paste the following command to update the OS and tools, install Docker CE, install Docker Compose, set the Docker service to automatically start when the OS starts, and add yourself to the Docker group so that you can execute Docker commands. Immediately after submitting this command, you may be prompted for your password. After that, the process will run completely unattended, and will end with a reboot of the VM.
$ sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && sudo apt-get update && sudo apt-get install -y docker-ce && sudo usermod -aG docker $USER && sudo systemctl enable docker && sudo curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose && sudo reboot