Docker updating to newer version

Below is my travis server info:

Build system information
Build language: go
Build group: stable
Build dist: trusty
Build id: 40102759
Job id: 40102760
Runtime kernel version: 4.19.86
Build image provisioning date and time
Fri Dec 13 12:23:44 UTC 2019
Operating System Details
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
Systemd Version
systemd 229
Cookbooks Version
e049581 https://github.com/travis-ci/travis-cookbooks/tree/e049581
git version
git version 2.24.1
bash version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
gcc version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:20:43 2018
 OS/Arch:           linux/amd64
 Experimental:      false

I followed https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version to update docker for new features, but it’s not working.

before_install:
  # Install Docker 18.09+ for enabling DOCKER_BUILDKIT: https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
  - 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 -y -o Dpkg::Options::="--force-confnew" install docker-ce
  # After upgrade, I had to restart docker and move docker-cli to /usr/local/bin
  - sudo systemctl restart docker
  - sudo chgrp travis /var/run/docker.sock
  - sudo cp /usr/bin/docker /usr/local/bin/docker
  - docker info

Could we update the doc or give me some advice for this issue?

Trusty with apt addon (as documented) updates the Docker version from 17.09.0 to 18.06.3-ce

Newer images have newer versions as well; e.g., focal.