2016-09-06

於 Debian 7 手動降版至 docker-engine 1.10.3

最近凍仁在 Debian 7 上升級 docker-engine 一直失敗,查看 error log 才得知 Docker 1.12.0+ 需使用 Linux Kernel 3.10.0+ 才行,但偏偏 apt 套件管理員還傻傻的把它給升上 1.12.1。若大家有相同的困擾就請先降版,再綁定 docker-engine 的版本吧!


▲ 2016/09/02 踩完雷後的凍仁碎碎唸。

1. 成功使用 apt 升級 Docker v1.12.1 了,但就是無法啟用 Docker domain。
[ jonny@wheezy ~ ]
$ docker ps [Enter]
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

2. 從 error log 中得知 Docker 1.12.0+ 只支援 Kernel 3.10.0+,不支援凍仁現在使用的 Kernel 3.2.0。
[ jonny@wheezy ~ ]
$ tail -f /var/log/docker.log [Enter]
...
time="2016-09-03T13:13:48.974874728+08:00" level=info msg="libcontainerd: new containerd process, pid: 20966" 
time="2016-09-03T13:13:49.977273934+08:00" level=fatal msg="Your Linux kernel version 3.2.0-4-amd64 is not supported for running docker. Please upgrade your kernel to 3.10.0 or newer."

3. 凍仁曾想藉由 apt-get install -f 來修復套件相依的問題,但都失敗了。
[ jonny@wheezy ~ ]
$ sudo apt-get install -f [Enter]
The following packages will be upgraded: 
docker-engine 
1 packages upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
Need to get 0 B/28.1 MB of archives. After unpacking 116 kB will be used.
Do you want to continue? [Y/n/?] 
(Reading database ... 275991 files and directories currently installed.)
Preparing to replace docker-engine 1.12.0-0~wheezy (using .../docker-engine_1.12.1-0~wheezy_amd64.deb) ...
[....] Stopping Docker: dockerstart-stop-daemon: warning: failed to kill 3752: No such process
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
[....] Stopping Docker: dockerstart-stop-daemon: warning: failed to kill 3752: No such process
No process in pidfile '/var/run/docker-ssd.pid' found running; none killed.
invoke-rc.d: initscript docker, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/docker-engine_1.12.1-0~wheezy_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/docker-engine_1.12.1-0~wheezy_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: error processing docker-engine (--configure):
Package is in a very bad inconsistent state - you should
reinstall it before attempting configuration.
Errors were encountered while processing:
docker-engine 

4. 手動移除 docker-engine 套件,並修復套件庫無法正常使用之問題。
[ jonny@wheezy ~ ]
$ sudo mv /var/lib/dpkg/info/docker-engine.* /tmp && \
  sudo dpkg --remove --force-remove-reinstreq docker-engine && \
  sudo apt-get remove docker-engine && \
  sudo apt-get autoremove && sudo apt-get autoclean  && \
  sudo apt-get install -f && \
  sudo apt-get update [Enter]

5. 成功移除 docker-engine 後,指定特定的版本 (v1.10.3) 安裝 docker-engine。
[ jonny@wheezy ~ ]
$ sudo apt-get install docker-engine=1.10.3-0~wheezy [Enter]

6. 綁定 docker-engine 版本。
[ jonny@wheezy ~ ]
$ sudo apt-mark hold docker-engine [Enter]
docker-engine set on hold.

現在凍仁又可以開心的在 Debian 7 裡把玩 docker 了,省下重灌電腦的時間可以寫好多好多的筆記啊!


▲ 2016/08/28 剛踩到雷超想重灌電腦,又沒時間的凍仁碎碎唸。

2016-09-25


今日發現 Docker 1.11.2 在 Kernel 3.2 上還是有些問題,故再次將 Docker 降版至 1.10.3,並修正此文章。

資料來源:
How to fix "Package is in a very bad inconsistent state" error? | Ask Ubuntu
software installation - How to install specific version of some package? | Ask Ubuntu
updates - How to prevent updating of a specific package? - Ask Ubuntu
安裝docker失敗記錄 - Feng______

沒有留言 :

張貼留言

謝謝您的寶貴意見,凍仁一定會盡快處理 ~^^