Hi Patrick,
thanks for the pointers. I tried today, and while it was easy to start my first
container, I am not really happy with LXD, exactly for the reason St?phane gives
in
https://stgraber.org/2016/03/11/lxd-2-0-introduction-to-lxd-112/ "How does
LXD relate to Docker/Rkt?"... what I really like about docker and
docker-compose is, that it encourages to separate code from data and
configuration, whereas with LXD you end up with the usual mix in your file
system - unless you really care (see also
https://cloud.google.com/blog/products/gcp/7-best-practices-operating-containers).
Also the image for ubuntu 18:04 was pretty outdated as dist-upgrade had to
update a lot. Looks like one ends up with lots of duplication (potentially
followed by deduplication of file system) keeping all containers up to date,
whereas in Docker one just replaces the containers.
I do see the Docker disadvantage of single app model relevant for Samba
though...
Best Regards, Joachim
> -----Urspr?ngliche Nachricht-----
> Von: Goetz, Patrick G <pgoetz at math.utexas.edu>
> Gesendet: Montag, 8. Juli 2019 18:08
> An: Joachim Lindenberg <samba at lindenberg.one>; samba at
lists.samba.org
> Betreff: Re: AW: AW: [Samba] Container setup?
>
>
> On 7/5/19 3:22 PM, Joachim Lindenberg wrote:
> >> I've only used LXD for containerizing web applications so far.
> > Maybe you can share how you build a container (equivalent of
Dockerfile)
> and how you configure a container (equivalent of docker-compose.yaml)?
> > Thanks, Joachim
>
> Sure, St?phane Graber's (main LXD developer) excellent blog is really
the best
> place to start:
>
> https://stgraber.org/2016/03/11/lxd-2-0-blog-post-series-012/
>
> Once LXD is installed, it's quite simple to get started:
>
> lxd init
>
> creates a basic general (YAML-encoded) framework by asking a bunch of
> questions. Then let's say you need an Ubuntu 16.04 - based container:
>
> lxc image copy ubuntu:16.04 local: --alias ubuntu16
>
> will make a local copy of the container image. Note: you don't need to
keep
> a local copy, but I find it faster and easier when I'm testing and
> creating/deleting containers frequently.
>
> Then:
>
> lxc launch ubuntu16 my_container -c security.privileged=true
>
> creates and launches a container called "my_container" based on
Ubuntu16.
>
> You can ssh to this container:
>
> lxc exec my_container -- bash
>
> and now you're root on an Ubuntu16 machine and can do whatever you
> would normally do on a linux host; e.g.
>
> # apt install samba
>
> You can pretty easily assign a static IP address, set up an included proxy
> daemon that proxies certain ports to this container, delete, snapshot,
etc..
>
> The way to think of this kind of container is that it's an independent
linux
> machine running on an existing linux box. A couple of years ago the
> conventional wisdom was LXD is great, but is hard to set up on anything but
> Ubuntu; but this is no longer true; I only run it on Arch linux host
systems
> and have had virtually no issues (sure, since Canonical bankrolls the
> development, it works best on Ubuntu).
>
> It's also pretty efficient; Canonical container engineer Dustin
Kirkland wrote a
> blog post about running 500 LXD containers simultaneously on his laptop.
>
> The hardest part for me was getting the networking right (bridge?
> macvlan? etc..); otherwise it's basically just like working with an
ordinary
> linux machine.
>