How to install specific version of Docker on Centos?
So you can use this command to check which versions are in the yum repo:
sudo yum list docker-engine.x86_64 --showduplicates | sort -r
and then use this to install the version listed that you want:
sudo yum -y install docker-engine-<VERSION_STRING>
If you simply want to downgrade the docker package (this can be performed multiple times, by the way), you'd do this:
sudo yum downgrade docker-engine
and that will install the previous version of docker to the one you currently have installed while cleaning up the later version.
You could always keep downgrading until you got the one you want, but that's annoying, so I'd just go with the first method :P
An update for Brittany's Answer As of Apr 2018 the package has been renamed to "docker-ce" (and docker-ee respectively if you're using docker enterprise version), so the commands are now:
check versions:
sudo yum list docker-ce.x86_64 --showduplicates | sort -r
install specific version:
sudo yum install docker-ce-<VERSION_STRING>
Or if you already installed the latest version, use downgrade:
sudo yum downgrade docker-ce-<VERSION_STRING>
List and install package(s)
sudo yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce-<VERSION_STRING>
Remove previous installation
sudo yum remove docker-ce docker-ce-cli