<div dir="ltr">Hi <span style="font-size:12.8px;white-space:nowrap">Stéphane,</span><div><span style="font-size:12.8px;white-space:nowrap"><br></span></div><div><span style="font-size:12.8px;white-space:nowrap">Thanks for your reply.</span></div><div><span style="font-size:12.8px;white-space:nowrap">That explains things.</span></div><div><span style="font-size:12.8px;white-space:nowrap"><br></span></div><div><span style="font-size:12.8px;white-space:nowrap">If you pardon the n00b I have a few more additional questions:</span></div><div><span style="font-size:12.8px;white-space:nowrap"><br></span></div><div><span style="font-size:12.8px;white-space:nowrap">I've been struggling to add an interface using the REST API while copying a container, but as far as I can judge if I copy an image I cannot add devices. Right?</span></div><div><span style="font-size:12.8px;white-space:nowrap"><br></span></div><div><span style="font-size:12.8px;white-space:nowrap">Also I've tried to make an image from a loclal container (again using the rest api).</span></div><div><span style="font-size:12.8px;white-space:nowrap">This doc:<a href="https://github.com/lxc/lxd/blob/master/doc/rest-api.md">https://github.com/lxc/lxd/blob/master/doc/rest-api.md</a></span></div><div><span style="font-size:12.8px;white-space:nowrap">suggests using this dict:</span></div><div><span style="font-size:12.8px;white-space:nowrap"><br></span></div><div><pre style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(247,247,247);border-radius:3px;color:rgb(51,51,51)"><code style="box-sizing:border-box;font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:13.6px;padding:0px;margin:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;background-color:transparent;border-radius:3px;word-break:normal;border:0px;display:inline;overflow:visible;line-height:inherit;word-wrap:normal">{
    "compression_algorithm": "xz",  # Override the compression algorithm for the image (optional)
    "filename": filename,           # Used for export (optional)
    "public":   true,               # Whether the image can be downloaded by untrusted users (defaults to false)
    "properties": {                 # Image properties (optional)
        "os": "Ubuntu"
    },
    "source": {
        "type": "container",        # One of "container" or "snapshot"
        "name": "abc"
    </code>}
}</pre></div><div class="gmail_extra">I tried this without any of the optional fields, but somehow no new image is made.</div><div class="gmail_extra">(I was also wondering if I could name the image one way or another)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks, Frans</div><div class="gmail_extra"><br><div class="gmail_quote">2017-02-12 18:45 GMT+01:00 Stéphane Graber <span dir="ltr"><<a href="mailto:stgraber@ubuntu.com" target="_blank">stgraber@ubuntu.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Sun, Feb 12, 2017 at 10:01:17AM +0100, Frans Meulenbroeks wrote:<br>
> Hi,<br>
><br>
> I want to get rid of the network interface that my container has, but<br>
> somehow I can't figure out how to get that done.<br>
><br>
> I have created a new container from scratch with:<br>
> lxc launch ubuntu:14.04 my-ubuntu<br>
><br>
> lxc config show my-ubuntu gives;<br>
><br>
> architecture: x86_64<br>
> config:<br>
>   image.architecture: amd64<br>
>   image.description: ubuntu 14.04 LTS amd64 (release) (20170202.1)<br>
>   image.label: release<br>
>   image.os: ubuntu<br>
>   image.release: trusty<br>
>   image.serial: "20170202.1"<br>
>   image.version: "14.04"<br>
>   volatile.base_image:<br>
> 3b825a6a063aacc6b19df84f7ddc4f<wbr>e872a0e382ec0bb92f475a9493b085<wbr>7e01<br>
>   volatile.eth0.hwaddr: 00:16:3e:25:48:06<br>
>   volatile.idmap.base: "0"<br>
>   volatile.idmap.next:<br>
> '[{"Isuid":true,"Isgid":false,<wbr>"Hostid":231072,"Nsid":0,"<wbr>Maprange":65536},{"Isuid":<wbr>false,"Isgid":true,"Hostid":<wbr>231072,"Nsid":0,"Maprange":<wbr>65536}]'<br>
>   volatile.last_state.idmap:<br>
> '[{"Isuid":true,"Isgid":false,<wbr>"Hostid":231072,"Nsid":0,"<wbr>Maprange":65536},{"Isuid":<wbr>false,"Isgid":true,"Hostid":<wbr>231072,"Nsid":0,"Maprange":<wbr>65536}]'<br>
>   volatile.last_state.power: RUNNING<br>
> devices:<br>
>   root:<br>
>     path: /<br>
>     type: disk<br>
> ephemeral: false<br>
> profiles:<br>
> - default<br>
<br>
</div></div>That shows that your container is inheriting from the "default" profile<br>
which likely does include that eth0 device.<br>
<br>
    lxc config show --expanded my-ubuntu<br>
<br>
Would show you the config with the profiles applied.<br>
<br>
To remove something that's inherited from a profile, you have to mask it<br>
with something like:<br>
<br>
    lxc config device add my-ubuntu eth0 none<br>
<br>
Which masks the inherited device "eth0" with an empty one.<br>
<div><div class="h5"><br>
> Note: no nic device, but there is a volatile.eth0.hwaddr address<br>
><br>
> And if I look into the container with lxc exec my-ubuntu --  ifconfig -a<br>
><br>
> eth0      Link encap:Ethernet  HWaddr 00:16:3e:25:48:06<br>
>           inet addr:10.202.122.138  Bcast:10.202.122.255  Mask:255.255.255.0<br>
>           inet6 addr: fe80::216:3eff:fe25:4806/64 Scope:Link<br>
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1<br>
>           RX packets:95 errors:0 dropped:0 overruns:0 frame:0<br>
>           TX packets:74 errors:0 dropped:0 overruns:0 carrier:0<br>
>           collisions:0 txqueuelen:1000<br>
>           RX bytes:19120 (19.1 KB)  TX bytes:7960 (7.9 KB)<br>
><br>
> lo        Link encap:Local Loopback<br>
>           inet addr:127.0.0.1  Mask:255.0.0.0<br>
>           inet6 addr: ::1/128 Scope:Host<br>
>           UP LOOPBACK RUNNING  MTU:65536  Metric:1<br>
>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0<br>
>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0<br>
>           collisions:0 txqueuelen:1<br>
>           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)<br>
><br>
> And if I do lxc network show lxdbr0 I see that the container is using the<br>
> bridge.<br>
><br>
> $ lxc network show lxdbr0<br>
> config:<br>
>   dns.mode: dynamic<br>
>   ipv4.address: <a href="http://10.202.122.1/24" rel="noreferrer" target="_blank">10.202.122.1/24</a><br>
>   ipv4.dhcp.ranges: 10.202.122.2-10.202.122.254<br>
>   ipv4.nat: "true"<br>
>   ipv6.address: none<br>
> name: lxdbr0<br>
> type: bridge<br>
> usedby:<br>
> ...<br>
> - /1.0/containers/my-ubuntu<br>
> ...<br>
> managed: true<br>
><br>
><br>
> ButI cannot remove the device from the bridge:<br>
><br>
> lxc network detach lxdbr0 my-ubuntu<br>
> error: No device found for this network<br>
><br>
> Is there a way to get rid of this interface?<br>
><br>
> (actually I want to attach eth0 to a different bridge)<br>
<br>
</div></div>To attach it to a different bridge, you'll want to mask the inherited<br>
"eth0" with another eth0 that's attached to the bridge you want:<br>
<br>
<br>
    lxc config device add my-ubuntu eth0 nic nictype=bridged parent=new-bridge<br>
<br>
<br>
Or on recent LXD, this will achieve the same:<br>
<br>
    lxc network attach new-bridge my-ubuntu eth0<br>
<br>
><br>
> Thanks in advance!<br>
> Frans<br>
<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>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
Stéphane Graber<br>
Ubuntu developer<br>
<a href="http://www.ubuntu.com" rel="noreferrer" target="_blank">http://www.ubuntu.com</a><br>
</font></span><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>