Containers & Images Missing after apt upgrade/dist-upgrade - Ubuntu 18.04

Hi - so I am running docker on my Ubuntu 18.04.4 headless server. I have 8 containers installed and running. I am able to access all of the containers without issue.

I installed following the guide on the docker website.

This morning I logged into my server to check the containers, and when I issued the docker ps command, no containers showed up. I did a docker ps -a, and only the hello-world container was listed.

I started to freak out, but I noticed that all of my containers were still accessible through my browser (portainer, bitwarden, nzbhydra, etc.). I’m not sure what’s going on, but hoping someone might be able to help. Here is the docker version I’m running:

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b7f0
 Built:             Wed Mar 11 01:25:46 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b7f0
  Built:            Wed Mar 11 01:24:19 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Well I rebooted my ubuntu machine today to install additional updates, and now I am able to run docker ps -a and get a list of my containers. However, when I try to manually start/stop/etc. a container, or run docker ps, I get the following error:

Error response from daemon: client version 1.40 is too new. Maximum supported API version is 1.39

Edit /etc/environment

add

DOCKER_API_VERSION=1.39

Thanks - that fixed it!