如何在另一个分区上运行docker LXC容器? [英] How to run docker LXC containers on another partition?
问题描述
我的系统有两个分区:
- 安装Ubuntu的5G主分区
- 100G侧面分区在
/ mnt / eda
,我想用于Docker容器运行
- 5G main partition where Ubuntu is installed
- 100G side partition at
/mnt/eda
that I'd like to use for Docker container runs
我需要启动多个Docker容器,这些容器在启动后将占用> 10G的额外磁盘空间。我想让他们使用 / mnt / eda
的磁盘空间,但是该怎么做?
I need to start multiple Docker containers that will take up >10G additional disk space after they're launched. I want them to use disk space form /mnt/eda
, but how do I do that?
目前,每当我导入或运行一个容器,我的主分区空间被占用。我尝试下载二进制文件并从侧面分区启动,但主分区的空间仍然被用尽。
Currently, whenever I import or run a container, space from my main partition is taken up. I tried downloading the binary and starting it from the side partition, but space from main partition was still being used up.
我无法将驱动器附加到我的容器 - 他们必须与主机完全分离,以确保安全。
I can't attach/mount drives to my containers -- they must be completely separate from the host for security.
推荐答案
当然没问题!
您可以:
- 在
/ var / lib / docker
- 做一个符号链接;例如从
/ var / lib / docker
到/ mnt / eda / docker
- bind-mount例如
/ mnt / eda / docker
to/ var / lib / docker
- mount the partition on
/var/lib/docker
- make a symlink; e.g. from
/var/lib/docker
to/mnt/eda/docker
- bind-mount e.g.
/mnt/eda/docker
to/var/lib/docker
这篇关于如何在另一个分区上运行docker LXC容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!