don't touch /var/lib/docker during run container else ERROR: device or resource busy

本文涉及的产品
云原生数据库 PolarDB MySQL 版,通用型 2核4GB 50GB
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
简介:
我用的环境是CentOS 6.5 x64, docker-io-1.1.2-1版本.
docker-io包来自EPEL, 
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

docker-io 包的内容如下:
[root@150 ~]# rpm -ql docker-io
/etc/bash_completion.d
/etc/bash_completion.d/docker.bash
/etc/rc.d/init.d/docker
/etc/sysconfig/docker
/etc/udev/rules.d
/etc/udev/rules.d/80-docker.rules
/usr/bin/docker
/usr/libexec/docker
/usr/libexec/docker/dockerinit
/usr/share/doc/docker-io-1.1.2
/usr/share/doc/docker-io-1.1.2/AUTHORS
/usr/share/doc/docker-io-1.1.2/CHANGELOG.md
/usr/share/doc/docker-io-1.1.2/CONTRIBUTING.md
/usr/share/doc/docker-io-1.1.2/FIXME
/usr/share/doc/docker-io-1.1.2/LICENSE
/usr/share/doc/docker-io-1.1.2/LICENSE-vim-syntax
/usr/share/doc/docker-io-1.1.2/MAINTAINERS
/usr/share/doc/docker-io-1.1.2/NOTICE
/usr/share/doc/docker-io-1.1.2/README-vim-syntax.md
/usr/share/doc/docker-io-1.1.2/README.md
/usr/share/man/man1/docker-attach.1.gz
/usr/share/man/man1/docker-build.1.gz
/usr/share/man/man1/docker-commit.1.gz
/usr/share/man/man1/docker-cp.1.gz
/usr/share/man/man1/docker-diff.1.gz
/usr/share/man/man1/docker-events.1.gz
/usr/share/man/man1/docker-export.1.gz
/usr/share/man/man1/docker-history.1.gz
/usr/share/man/man1/docker-images.1.gz
/usr/share/man/man1/docker-import.1.gz
/usr/share/man/man1/docker-info.1.gz
/usr/share/man/man1/docker-inspect.1.gz
/usr/share/man/man1/docker-kill.1.gz
/usr/share/man/man1/docker-load.1.gz
/usr/share/man/man1/docker-login.1.gz
/usr/share/man/man1/docker-logs.1.gz
/usr/share/man/man1/docker-pause.1.gz
/usr/share/man/man1/docker-port.1.gz
/usr/share/man/man1/docker-ps.1.gz
/usr/share/man/man1/docker-pull.1.gz
/usr/share/man/man1/docker-push.1.gz
/usr/share/man/man1/docker-restart.1.gz
/usr/share/man/man1/docker-rm.1.gz
/usr/share/man/man1/docker-rmi.1.gz
/usr/share/man/man1/docker-run.1.gz
/usr/share/man/man1/docker-save.1.gz
/usr/share/man/man1/docker-search.1.gz
/usr/share/man/man1/docker-start.1.gz
/usr/share/man/man1/docker-stop.1.gz
/usr/share/man/man1/docker-tag.1.gz
/usr/share/man/man1/docker-top.1.gz
/usr/share/man/man1/docker-unpause.1.gz
/usr/share/man/man1/docker-version.1.gz
/usr/share/man/man1/docker-wait.1.gz
/usr/share/man/man1/docker.1.gz
/usr/share/man/man5/Dockerfile.5.gz
/usr/share/vim/vimfiles/doc
/usr/share/vim/vimfiles/doc/dockerfile.txt
/usr/share/vim/vimfiles/ftdetect
/usr/share/vim/vimfiles/ftdetect/dockerfile.vim
/usr/share/vim/vimfiles/syntax
/usr/share/vim/vimfiles/syntax/dockerfile.vim
/usr/share/zsh/site-functions/_docker
/var/lib/docker


/var/lib/docker 应该是存放本地image的目录. 在pull期间, 我只是du -sh了这个目录, 导致了pull失败, 如下 : 
检索docker hub中包含postgresql的images.

[root@150 ~]# docker search postgresql
NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
postgres                                 PostgreSQL is a powerful, open source obje...   208       [OK]       
......
radbot/postgresql-9.3.5                                                                  0                    
......


运行这个image, 因为本地没有这个image, 所以会自动下载 : 
[root@150 ~]# docker run radbot/postgresql-9.3.5 psql -V
Unable to find image 'radbot/postgresql-9.3.5' locally
Pulling repository radbot/postgresql-9.3.5
d61abc8c1dd3: Error pulling image (latest) from radbot/postgresql-9.3.5, Error mounting '/dev/mapper/docker-8:1-786593-68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280' on '/var/lib/docker/devicemapper/mnt/68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280': device or resource busy 6b950129ba1af9280': device or resource busy 
9942dd43ff21: Download complete 
d92c3c92fa73: Download complete 
0ea0d582fd90: Download complete 
cc58e55aa5a5: Download complete 
c4ff7513909d: Download complete 
68b76f93ae18: Download complete 
82fe8ad2c400: Error downloading dependent layers 
2014/09/29 09:58:02 Error pulling image (latest) from radbot/postgresql-9.3.5, Error mounting '/dev/mapper/docker-8:1-786593-68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280' on '/var/lib/docker/devicemapper/mnt/68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280': device or resource busy

创建container, unifs等.
不清楚是什么原因造成这个失败的, 我只是在这个过程中du了/var/lib/docker的目录. 
失败后, 这个image还在本地.

[root@150 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04               c3d5614fecc4        24 hours ago        194.8 MB
<none>              <none>              68b76f93ae18        5 weeks ago         232.9 MB
[root@150 ~]# docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04               c3d5614fecc4        24 hours ago        194.8 MB
<none>              <none>              96e1c132acb3        24 hours ago        194.8 MB
<none>              <none>              311ec46308da        24 hours ago        192.8 MB
<none>              <none>              1b2af7d5307a        24 hours ago        192.7 MB
<none>              <none>              c31865d83ea1        24 hours ago        192.7 MB
<none>              <none>              8cbdf71a8e7f        24 hours ago        192.6 MB
<none>              <none>              68b76f93ae18        5 weeks ago         232.9 MB
<none>              <none>              c4ff7513909d        6 weeks ago         213 MB
<none>              <none>              cc58e55aa5a5        6 weeks ago         213 MB
<none>              <none>              0ea0d582fd90        6 weeks ago         192.7 MB
<none>              <none>              d92c3c92fa73        6 weeks ago         192.7 MB
<none>              <none>              9942dd43ff21        6 weeks ago         192.7 MB
<none>              <none>              1c9383292a8f        6 weeks ago         192.5 MB
<none>              <none>              511136ea3c5a        15 months ago       0 B

删除image
[root@150 ~]# docker rmi -f 68b76f93ae18
Deleted: 68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280
Deleted: c4ff7513909dedf4ddf3a450aea68cd817c42e698ebccf54755973576525c416
Deleted: cc58e55aa5a53b572f3b9009eb07e50989553b95a1545a27dcec830939892dba
Deleted: 0ea0d582fd9027540c1f50c7f0149b237ed483d2b95ac8d107f9db5a912b4240
Deleted: d92c3c92fa73ba974eb409217bb86d8317b0727f42b73ef5a05153b729aaf96b
Deleted: 9942dd43ff211ba917d03637006a83934e847c003bef900e4808be8021dca7bd
Deleted: 1c9383292a8ff4c4196ff4ffa36e5ff24cb217606a8d1f471f4ad27c4690e290


[root@150 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04               c3d5614fecc4        24 hours ago        194.8 MB

再次运行依然失败, 说明问题不在image
[root@150 ~]# docker run radbot/postgresql-9.3.5 psql -V
Unable to find image 'radbot/postgresql-9.3.5' locally
Pulling repository radbot/postgresql-9.3.5
d61abc8c1dd3: Error pulling image (latest) from radbot/postgresql-9.3.5, Driver devicemapper failed to create image rootfs 68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280: device 68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280 already exists 5b0608253106b950129ba1af9280 already exists 
9942dd43ff21: Download complete 
d92c3c92fa73: Download complete 
0ea0d582fd90: Download complete 
cc58e55aa5a5: Download complete 
c4ff7513909d: Download complete 
68b76f93ae18: Error downloading dependent layers 
2014/09/29 10:07:06 Error pulling image (latest) from radbot/postgresql-9.3.5, Driver devicemapper failed to create image rootfs 68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280: device 68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280 already exists

应该是创建container时造成的失败, 需要删除这个设备后才可以正常.
当前不能删除这个设备.

[root@150 ~]# dmsetup remove -f /dev/mapper/docker-8:1-786593-68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280
device-mapper: resume ioctl on docker-8:1-786593-68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280 failed: Invalid argument
device-mapper: remove ioctl on docker-8:1-786593-68b76f93ae18b25093f6d45a85f203c66af75b0608253106b950129ba1af9280 failed: Device or resource busy
Command failed


重启服务器, 再次pull, run成功.
[root@150 ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04               c3d5614fecc4        24 hours ago        194.8 MB
<none>              <none>              c4ff7513909d        6 weeks ago         213 MB
[root@150 ~]# docker rmi c4ff7513909d
Deleted: c4ff7513909dedf4ddf3a450aea68cd817c42e698ebccf54755973576525c416
Deleted: cc58e55aa5a53b572f3b9009eb07e50989553b95a1545a27dcec830939892dba
Deleted: 0ea0d582fd9027540c1f50c7f0149b237ed483d2b95ac8d107f9db5a912b4240
Deleted: d92c3c92fa73ba974eb409217bb86d8317b0727f42b73ef5a05153b729aaf96b
Deleted: 9942dd43ff211ba917d03637006a83934e847c003bef900e4808be8021dca7bd
Deleted: 1c9383292a8ff4c4196ff4ffa36e5ff24cb217606a8d1f471f4ad27c4690e290
[root@150 ~]# docker run radbot/postgresql-9.3.5 psql -V
Unable to find image 'radbot/postgresql-9.3.5' locally
Pulling repository radbot/postgresql-9.3.5
d61abc8c1dd3: Download complete 
511136ea3c5a: Download complete 
1c9383292a8f: Download complete 
9942dd43ff21: Download complete 
d92c3c92fa73: Download complete 
0ea0d582fd90: Download complete 
cc58e55aa5a5: Download complete 
c4ff7513909d: Download complete 
68b76f93ae18: Download complete 
82fe8ad2c400: Download complete 
psql (PostgreSQL) 9.3.5

[root@150 yum.repos.d]# docker images
REPOSITORY                TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu                    14.04               c3d5614fecc4        25 hours ago        194.8 MB
radbot/postgresql-9.3.5   latest              d61abc8c1dd3        5 weeks ago         309 MB


[参考]
1. man docker
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
2月前
|
存储 关系型数据库 MySQL
|
2月前
|
网络虚拟化 Docker 容器
docker Desktop报错 error pulling image configuration 处理
docker Desktop报错 error pulling image configuration 处理
42 0
|
2月前
|
Shell 应用服务中间件 nginx
docker学习--最详细的docker run 各子命令解释与应用
`docker run` 是 Docker 中用于启动容器的基本命令。常用子命令包括 `-i`(交互模式)、`-t`(分配终端)、`-d`(后台运行)、`-p`(端口映射)、`--name`(指定容器名)。例如,`docker run -it nginx:1.20 /bin/bash` 可以创建并进入交互式容器。使用 `-d` 可在后台运行容器,`-p` 可将容器端口映射到主机端口,`--name` 则用于自定义容器名称以便管理。
221 0
|
3月前
|
Docker 容器
docker run
【9月更文挑战第08天】
113 1
|
3月前
|
NoSQL Redis Docker
5-11write /var/lib/docker/tmp/GetImageBlob2366037717: no space left on device
5-11write /var/lib/docker/tmp/GetImageBlob2366037717: no space left on device
|
3月前
|
关系型数据库 MySQL 数据库
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
207 0
|
网络协议 关系型数据库 PostgreSQL
|
2天前
|
监控 Docker 容器
在Docker容器中运行打包好的应用程序
在Docker容器中运行打包好的应用程序
|
2天前
|
存储 缓存 监控
Docker容器性能调优的关键技巧,涵盖CPU、内存、网络及磁盘I/O的优化策略,结合实战案例,旨在帮助读者有效提升Docker容器的性能与稳定性。
本文介绍了Docker容器性能调优的关键技巧,涵盖CPU、内存、网络及磁盘I/O的优化策略,结合实战案例,旨在帮助读者有效提升Docker容器的性能与稳定性。
19 6
|
2天前
|
存储 Prometheus 监控
Docker容器内进行应用调试与故障排除的方法与技巧,包括使用日志、进入容器检查、利用监控工具及检查配置等,旨在帮助用户有效应对应用部署中的挑战,确保应用稳定运行
本文深入探讨了在Docker容器内进行应用调试与故障排除的方法与技巧,包括使用日志、进入容器检查、利用监控工具及检查配置等,旨在帮助用户有效应对应用部署中的挑战,确保应用稳定运行。
13 5