Upgrade Docker Engine to Specific Version
1. Update package information
This is to ensure that APT works with the https method, and that CA certificates are installed:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates
2. Add the new GPG key
FYI: This commands downloads the key with the ID 58118E89F3A912897C070ADBF76221572C52609D from the keyserver hkp://ha.pool.sks-keyservers.net:80 and adds it to the adv keychain. For more info, see the output of man apt-key.
sudo apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
3. Add specific repo for your distro to docker.list
FYI available repos:
Ubuntu version Repository
Precise 12.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-precise main
Trusty 14.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-trusty main
Wily 15.10 deb https://apt.dockerproject.org/repo ubuntu-wily main
Xenial 16.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-xenial main
So in our case:
mkdir -p /etc/apt/sources.list.d
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
4. Update the APT package index
sudo apt-get update
5. Verify that APT is pulling from the right repository
FYI: When you run the following command, an entry is returned for each version of Docker that is available for you to install. Each entry should have the URL https://apt.dockerproject.org/repo/. The version currently installed is marked with *.
apt-cache policy docker-engine
6. Install the linux-image-extra-* kernel packages
FYI: For Ubuntu Trusty, Wily, and Xenial, install the linux-image-extra-* kernel packages, which allows you use the aufs storage driver.
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
7. Finally Install a specific version of Docker Engine
7.1 List all available versions using apt-cache madison
apt-cache madison docker-engine
Example:
ubuntu@dev01:~$ apt-cache madison docker-engine
docker-engine | 1.12.6-0~ubuntu-trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.5-0~ubuntu-trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.4-0~ubuntu-trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.3-0~trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.2-0~trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.1-0~trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
docker-engine | 1.12.0-0~trusty | https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
7.2 Install docker-engine 1.12.6
FYI: If you already have a newer version installed, you will be prompted to downgrade Docker. Otherwise, the specific version will be installed.
sudo apt-get install docker-engine=1.12.6-0~ubuntu-trusty
8. Start the docker daemon
sudo service docker start
9. Verify that docker is installed correctly by running the hello-world image
sudo docker run hello-world
Based on: https://docs.docker.com/engine/installation/linux/ubuntulinux/
End.
Step 7.2 Block and display 0% [Working]
sudo apt-get install docker-engine=1.12.6-0~ubuntu-trusty
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
#......
#......
Use 'apt-get autoremove' to remove them.
The following packages will be upgraded:
docker-engine
1 upgraded, 0 newly installed, 0 to remove and 386 not upgraded.
Need to get 19.1 MB of archives.
After this operation, 12.8 MB disk space will be freed.
0% [Working]
You need to change the step 3 command as(use ali mirror source):
echo "deb [arch=amd64] http://mirrors.aliyun.com/docker-engine/apt/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
Retry.