在Linux下安装docker记录

本文记录了在Debian 8 i686上安装Docker的过程及遇到的ldconfig和start-stop-daemon命令缺失的问题,以及如何通过添加源和编译解决。由于系统版本不兼容,最终切换到Ubuntu x86_64并成功安装Docker。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装docker.io包之前,需要先设置使用backports源

编辑/etc/apt/sources.list文件,加入下面这一句:
deb http://http.debian.net/debian jessie-backports main

然后执行:

$sudo apt-get update

$sudo apt-get install docker.io


如果出现:

dpkg: warning: 'ldconfig' not found in PATH or not executable

dpkg: warning: 'start-stop-daemon' not found in PATH or not executable

dpkg: error: 2 expected program not found in PATH or not executable


解决ldconfig找不到的问题:

$apt-cache search ldconfig

得到:libc-bin - GNU C Library: Binaries

$sudo apt-get install libc-bin

然后我执行了一下:

$ldconfig

得到:bash: ldconfig: command not found

$/sbin/ldconfig

得到:

/sbin/ldconfig.real: Can't link /usr/lib/i386-linux-gnu/libfakeroot/libfakeroot-0.so to libfakeroot-tcp.so

/sbin/ldconfig.real: Can't create temporary cache file /etc/ld.so.cache~: Permission denied

#这个表示找到了

然后:

$su

$export PATH=/usr/loca/sbin:/usr/sbin:/sbin:$PATH

#这样就解决了


解决start-stop-daemon找不到的问题:

在https://stackoverflow.com/questions/25271936/expected-program-not-found-in-path-or-not-executable 看的做法

$cd /tmp
$wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
$tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
$cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
$gcc start-stop-daemon.c -o start-stop-daemon
$cp start-stop-daemon /usr/local/bin/start-stop-daemon

#但我不建议大家这么做,会出问题的,最好还是像解决ldconfig的问题那样去解决这个。


docker安上了,但是在执行以下命令的时候:

$sudo docker run hello-world

报错了:

FATA[0002] Error response from daemon: Cannot start container 22692eb807f4a73959e6cbfc6313bb4ea3670898b3e6f791cd87f4a4afe96057: [8] System error: exec format error

#是系统版本原因,官网要求是64位,我是Debian 8 i686的。


换成Ubuntu x86_64

按照官网来,一次成功。。

过程如下:

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo apt-key fingerprint 0EBFCD88

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

$ sudo apt-get update

$ sudo apt-get install docker-ce

$ apt-cache madison docker-ce

得到类似:

docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages

$ sudo apt-get install docker-ce=17.03.0~ce-0~ubuntu-xenial #版本按照上面来

$ sudo docker run hello-world  #测试能不能运行,ok啦

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值