如何在另一个分区上运行docker LXC容器? [英] How to run docker LXC containers on another partition?

查看:308
本文介绍了如何在另一个分区上运行docker LXC容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统有两个分区:


  • 安装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屋!

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