<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 9, 2017 at 3:02 AM, John Lewis <span dir="ltr"><<a href="mailto:oflameo2@gmail.com" target="_blank">oflameo2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>I am trying to build containers on my really powerful desktop and
then export them to VPS provider who would shut off my machine if
it takes too much CPU time.</p></div></blockquote><div><br></div><div>Uh ... use another VPS provider?</div><div>EC2 gives out one year free tier, which includes t2.micro, suitable for small sites.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
<p>Moving one an system image file is much faster to move than
moving a root of a system recursively. It is also far less error
prone. Having to maintain premount scripts is inconvenient
compared to having LXC do it. I can't use LXD yet because my whole
environment is Debian 8.<br>
</p><div><div class="gmail-h5">
<br></div></div></div></blockquote><div><br></div><div>If you can switch to ubuntu as host, I highly recomend lxd + zfs backend. You can then transfer the rootfs using "lxc copy" or zfs snapshot/clone.</div><div><br></div><div><br></div><div>Anyway, back to your question. I assume that:</div><div>- you have root access to the VPS</div><div>- you have full control of the kernel (i.e. Xen/KVM, not virtuozzo VPS)</div><div><br></div><div>In that case, you can create unprivileged,root-owned,loop-backed container by simply doing something like this as root:</div><div><br></div><div># lxc-create -n alpine -t download -B loop -- -d alpine -r 3.4 -a amd64<br></div><div><br></div><div>... of course, to make it unpriv, you need to have proper lxc.id_map setting (e.g. follow <a href="https://linuxcontainers.org/lxc/getting-started/">https://linuxcontainers.org/lxc/getting-started/</a>), which I assume you already have. The main point to use loopback is "-B loop" in lxc-create. The resulting lxc config file would have entries like these:</div><div><br></div><div><div># Container specific configuration</div><div>lxc.id_map = u 0 165536 65536</div><div>lxc.id_map = g 0 165536 65536</div><div>lxc.rootfs = loop:/var/lib/lxc/alpine/rootdev</div><div>lxc.rootfs.backend = loop</div></div><div><br></div><div>-- </div><div>Fajar</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><div><div class="gmail-h5">
<div class="gmail-m_5603796267191899064moz-cite-prefix">On 02/08/2017 08:42 AM, Fajar A.
Nugraha wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="gmail-h5">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Wed, Feb 8, 2017 at 7:57 PM, John
Lewis <span dir="ltr"><<a href="mailto:oflameo2@gmail.com" target="_blank">oflameo2@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Can
unprivileged containers start from a loop device?<br>
</blockquote>
<div><br>
</div>
<div>IMHO you should explain what you're trying to achieve,
and how you think using a loop device will help.</div>
<div><br>
</div>
<div>I can say that "lxd uses unpriv containers by default,
and it also creates a zfs pool on top of file as container
storage by default", which satisfies both the "unpriv
container" and "loop device" (somewhat) part of your
question, but probably not what you're looking for.</div>
<div><br>
</div>
<div>-- </div>
<div>Fajar</div>
</div>
</div>
</div>
<br>
<fieldset class="gmail-m_5603796267191899064mimeAttachmentHeader"></fieldset>
<br>
</div></div><span class="gmail-"><pre>______________________________<wbr>_________________
lxc-users mailing list
<a class="gmail-m_5603796267191899064moz-txt-link-abbreviated" href="mailto:lxc-users@lists.linuxcontainers.org" target="_blank">lxc-users@lists.<wbr>linuxcontainers.org</a>
<a class="gmail-m_5603796267191899064moz-txt-link-freetext" href="http://lists.linuxcontainers.org/listinfo/lxc-users" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a></pre>
</span></blockquote>
<br>
</div>
<br>______________________________<wbr>_________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.<wbr>linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br></blockquote></div><br></div></div>