6
2
I have done some Docker testing over the years, but for a specific kind of testing, I need a little more then just application containers. So I turned to LXC/LXD containers, which is great. After installing LXD I created my own container:
>> willem@ubuntu:/$ lxc launch images:centos/7/amd64 thing Creating thing
Starting thing
>> willem@ubuntu:/$ lxc list
+-------+---------+------------------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-------+---------+------------------+------+------------+-----------+
| thing | RUNNING | 10.0.3.30 (eth0) | | PERSISTENT | 0 |
+-------+---------+------------------+------+------------+-----------+
Great. Only I don't seem to have any control over the IP address here. I found (with help of Google and locate) a control file:
>> root@ubuntu:/# locate lxc.conf
/etc/init/lxc.conf
..
/var/log/lxd/thing/lxc.conf
in which you can put a (what looks like) static IP4-address. Only upon rebooting the container, the host seem to have forgotten my static IP, and takes the one from DHCP. Questions:
- What is the right way of doing this (I mean, the latest Docker has an
--ip
switch indocker run
which sets the IP address) ?
You might want to remove your last 2 bullet points. Requests for tutorials and books are off-topic. – DavidPostill – 2016-03-02T22:12:00.433