[Samba] Container setup?

Goetz, Patrick G pgoetz at math.utexas.edu
Mon Jul 8 16:08:17 UTC 2019


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.




More information about the samba mailing list