Icons take several seconds to appear/disappear from the dock when the app is opened/closed
If your dock is empty besides the "Show Applications" button, the delayed/missing update of icons in the dock is most probably caused by https://github.com/micheleg/dash-to-dock/issues/1188 and will be fixed by https://github.com/micheleg/dash-to-dock/pull/1222 . A bug report for the ubuntu version of the dock is tracked here: https://bugs.launchpad.net/ubuntu/+source/gnome-shell-extension-ubuntu-dock/+bug/1880570