四、device or resource busy
有时候创建、删除、停止容器的时候,会报错如下:
$ docker start c39206003c7a
Error: Cannot start container c39206003c7a: Error getting container c39206003c7ae8992a554a9ac2ea130327fc4af1b2c389656c34baf9a56c84b5 from driver devicemapper: Error mounting '/dev/mapper/docker-253:0-267081-c39206003c7ae8992a554a9ac2ea130327fc4af1b2c389656c34baf9a56c84b5' on '/var/lib/docker/devicemapper/mnt/c39206003c7ae8992a554a9ac2ea130327fc4af1b2c389656c34baf9a56c84b5': device or resource busy
Error: failed to start one or more containers
$ docker rm c39206003c7a
Error: Cannot destroy container c39206003c7a: Driver devicemapper failed to remove root filesystem c39206003c7ae8992a554a9ac2ea130327fc4af1b2c389656c34baf9a56c84b5: Error running removeDevice
Error: failed to remove one or more containers 解决方式2种:
4.1 出现问题一般是storage driver是devicemapper, 更换操作系统用Ubuntu的aufs或者redhat的overlay
4.2 取消挂载
umount /var/lib/devicemapper/mnt/容器id 再删除/重启 就可以了
五、docker - container里面 su 报错:Resource temporarily unavailable
这个现象目前只在centos7出现过
docker exec -it 206f56b7da86 /bin/bash
[root@vm storm]# su - storm
su: /bin/bash: Resource temporarily unavailable 解决方式:
docker exec -it 206f56b7da86 /bin/bash
[root@vm storm]# cd /etc/pam.d/
[root@vm pam.d]# vi su 将里面session 的参数都改为optional
例子:
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session optional system-auth
session optional pam_xauth.so