码头工人磁盘空间不足 [英] docker out of disk space

查看:117
本文介绍了码头工人磁盘空间不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在docker和卷大小方面遇到了麻烦.我正在运行docker-machine 三个容器.给我带来麻烦的是MySQL容器,其中有一个 仅用于持久性的数据容器.当我尝试导入mysql文件时,mysql 抱怨表 满, 这实际上意味着磁盘空间不足.看着系统,我看到了 问题,但不知道如何解决:

I'm hainvg trouble with docker and volume size. I'm running docker-machine with three containers. The one giving me trouble is the MySQL container which has a data-only container for persistance. When I try to import a mysql file, mysql complains that the table is full, which really means that the disk is out of space. Looking at the system, I see the problem, but don't know how to correct it:

 _                 _   ____     _            _
 | |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
 | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
 | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
 |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
 Boot2Docker version 1.8.1, build master : 7f12e95 - Thu Aug 13 03:24:56 UTC
 2015
 Docker version 1.8.1, build d12ea79
 docker@default:~$ sudo -i
 Boot2Docker version 1.8.1, build master : 7f12e95 - Thu Aug 13 03:24:56 UTC
 2015
 Docker version 1.8.1, build d12ea79
 root@default:~# df -h
 Filesystem                Size      Used Available Use% Mounted on
 tmpfs                   896.6M    112.4M    784.2M  13% /
 tmpfs                   498.1M    136.0K    498.0M   0% /dev/shm
 /dev/sda1                 2.8G      2.7G         0 100% /mnt/sda1
 cgroup                  498.1M         0    498.1M   0% /sys/fs/cgroup
 none                    462.2G     32.8G    429.5G   7% /Users
 /dev/sda1                 2.8G      2.7G         0 100%
 /mnt/sda1/var/lib/docker/aufs
 none                      2.8G      2.7G         0 100%
 /mnt/sda1/var/lib/docker/aufs/mnt/0a90321d2e941e31385a4c4096e
 none                      2.8G      2.7G         0 100%
 /mnt/sda1/var/lib/docker/aufs/mnt/bca6fc0c017233ed634e7e19284
 none                      2.8G      2.7G         0 100%
 /mnt/sda1/var/lib/docker/aufs/mnt/7e432f020ee8fc9c6a211c810e5

我像这样创建了docker-machine,我以为这会给我我需要的空间,但是并没有.

I created the docker-machine like this, which I thought would give me the space I need, but it has not.

docker-machine create --virtualbox-disk-size 4000 -d virtualbox default

我正在这样创建mysql映像

I'm creating the mysql image like this

#!/bin/bash

echo "- checking that the image exists"
IMAGE=$(docker images | grep cp_mysql)
if [ -z "$IMAGE" ]; then
  echo '- image does not exist, building'
  docker build -t cp_mysql -f Dockerfile-app .
fi


echo "- checking if the mysql data volume exists"
DATA_VOL=$(docker ps -a | grep cp_mysql_data)

# if empty
if [ -z "$DATA_VOL" ]; then
  echo '- data volume is empty - building'
  DATA_VOL=$(docker build -t data -f Dockerfile-data_vol . | tail -n 1 | awk '{print $3}')
  docker run --name cp_mysql_data $DATA_VOL
  echo "- build data volume: $DATA_VOL"
else
  DATA_VOL=$(echo $DATA_VOL | awk '{print $1}')
  echo "- data volume is not empty - using existing volume: $DATA_VOL"
fi

echo '- check if existing cp_mysql_app exists'

APP=$(docker ps -a | grep cp_mysql_app)

if [ -z "$APP" ]; then
  echo '- the app does not exist, let us create it'
  docker run \
    --restart=always \
    --name cp_mysql_app \
    --restart=always \
    --volumes-from=cp_mysql_data \
    -e MYSQL_USER=cp \
    -e MYSQL_PASSWORD=cp \
    -e MYSQL_DATABASE=cp \
    -e MYSQL_ROOT_PASSWORD=root \
    -d \
    -p 3306:3306 cp_mysql
else
  echo '- the does exist, let us just run it'
  docker start cp_mysql_app
fi

这是我在那台机器上的码头工人信息

Here's my docker info for that machine

docker@default:~$ docker info
Containers: 0
Images: 0
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: tmpfs
 Dirs: 0
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 4.0.9-boot2docker
Operating System: Boot2Docker 1.8.1 (TCL 6.3); master : 7f12e95 - Thu Aug 13 03:24:56 UTC 2015
CPUs: 1
Total Memory: 996.2 MiB
Name: default
ID: XLSE:62WR:VWCR:T2Z6:FSE3:NTLV:EQRT:WLW5:NLPF:HPQH:JQGR:K4LZ
Debug mode (server): true
File Descriptors: 9
Goroutines: 16
System Time: 2015-09-08T16:31:38.029737031Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
 provider=virtualbox

我基本上需要的是/dev/sda1的无限制空间,或者能够指定较大的磁盘大小.我知道这是由于我对Docker挂载方式的误解引起的,但我认为该线程将推动我的研究.

What I basically need is unbounded space for /dev/sda1, or to be able to specify a large disk size. I know this stems from my misunderstanding how docker mounts work, but I thought this thread would jump-start my research.

谢谢.

推荐答案

选项--virtualbox-disk-size需要以MB输入(请参阅

The option --virtualbox-disk-size needs to be entered in MB (see Docker Machine Docs). You created your machine with 4GB. This gives docker 2.8GB for storing images and running containers on /dev/sda1.

docker-machine create使用的磁盘大小默认值为20GB(根据上面链接的文档).运行docker images -a将显示您拉出的映像需要多少磁盘空间.这将指示您需要多少空间.

The default value for disk size, which is used by docker-machine create, is 20GB (according to docs linked above). Running docker images -a will show you how much disk space is required by the images you pulled. This will give you an indication how much more space you need.

通常20GB是一个不错的大小,可以拉出多个不同的图像并运行一些容器.因此,也许您使用默认磁盘大小创建一台新计算机,然后尝试再次导入mysql文件.

Usually 20GB is a good size to pull several different images and run some containers. So maybe you create a new machine with the default disk size and try to import the mysql file again.

这篇关于码头工人磁盘空间不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆