1

我正在使用 boot2docker 上的卷容器来在 MacOS X 上运行 Docker。

boot2docker version
Client version: v1.2.0
Git commit: a551732

我正在尝试执行Docker 文档中提到的备份/恢复过程。

我正在尝试备份超过 2 GB 的 MySQL 数据库。当我运行备份命令时:

docker run --volumes-from data_volume -v $(pwd):/backup ubuntu tar cvf /backup/backup.tar /var/lib/mysql

...如果失败并出现此错误

tar: /backup/backup.tar: Wrote only 4096 of 10240 bytes
tar: Error is not recoverable: exiting now

似乎tar是磁盘空间不足。所以我进入我的容器并查看了主机绑定挂载,它的大小是 1.8 GB

docker run -t -i -v $HOME:/demo ubuntu /bin/bash
root@bb3921a48ba4:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           19G  8.3G  9.1G  48% /
none             19G  8.3G  9.1G  48% /
tmpfs          1005M     0 1005M   0% /dev
shm              64M     0   64M   0% /dev/shm
/dev/sda1        19G  8.3G  9.1G  48% /etc/hosts
tmpfs           1.8G  1.8G     0 100% /demo
tmpfs          1005M     0 1005M   0% /proc/kcore

可以看到/demo只有1.8G...

我不知道如何扩展这个大小,所以我可以做大备份......

任何的想法?谢谢!

4

1 回答 1

0

I have this sneaking feeling that you're running out of memory - as 2GB is the default amount of ram we allocate.

Rather than writing to a file, mapped to a virtual filesystem that is attached to your OSX box's FS, I'd suggest running the tar to output to STDOUT, and then pipe that to your local box.

ie

docker run --rm ubuntu tar cf - /etc > test.tar

于 2014-12-01T07:10:09.120 回答