Up walks through every command you ever ran. With two lines in ~/.inputrc it only shows the ones that start with what is already on the line.
Add these to ~/.inputrc, the config file for Readline:
"\e[A": history-search-backward
"\e[B": history-search-forward
\e[A and \e[B are the codes most terminals send for Up and Down. Open a new terminal, type docker, press Up, and you jump straight through your earlier docker commands. On an empty line the arrows behave exactly as before.
To try it without editing a file, run bind '"\e[A": history-search-backward' in the current shell first.
I like it more than Ctrl-r for the everyday case of ‘that ssh command from yesterday’. The file is read by other programs that use Readline too, which I count as a bonus.
If the arrows still do the old thing, your terminal may send \eOA instead; find out by pressing Ctrl-v and then Up at the prompt. And when ~/.inputrc did not exist before, also add $include /etc/inputrc at the top, otherwise the system-wide settings from your distribution stop loading.
Further reading: Bash manual: Readline Init File, Bash manual: Commands For Manipulating The History