I have docker installed but ubuntu products seem to be open-source-ware and not breaking my pocket book to do the same thing but docker seems to be more compatible with google cloud? I am not sure about LXD but I am installing it in the package manager with installation helpguides but I am not sure about deployment or how deploy models on ubuntu cloud vs. google cloud. I wish I could find a graphical relationship somewhere.

1

There are 1 best solutions below

0
On

The main distinction is that Docker provides application containers while LXD provides system containers.

An application container is a container that helps you run an application, a network service or something of that sort. When you are done with the application, then Docker terminates.

With LXD, you create system containers, which are very similar to a virtual machine. A system container is a Linux distribution runtime, and when you start it, that Linux distribution of your choice is booting up. It keeps running until you shut it down. Unlike a VM, a system container does not run its own Linux kernel; it re-uses the host's Linux kernel. Even if you launch a Fedora system container on your Ubuntu host, the Fedora system container is running over the Ubuntu Linux kernel (thanks to the Linux kernel's stable API).

Here is an example of creating a system container, installing nginx, and then accessing the web server. If you were to do this with Docker, you would need to create or find some Dockerfile. Since you are using traditional Linux administration commands, you have the freedom to test whichever commands you want. Just like with a VM.

In the following I create a system container called mycontainer with Ubuntu 20.04 (all major Linux distributions are supported). Then, I get a shell in the system container and update the package list. Subsequently, I install nginx. I log out from the container and check the IP address of the container. Finally, I access the website from the host. If I had Firefox running on the host, I could access the web server from Firefox.

$ lxc launch ubuntu:20.04 mycontainer
Creating mycontainer
Starting mycontainer
$ lxc shell mycontainer
root@mycontainer:~# apt update && apt install -y nginx
...
root@mycontainer:~# lsof -i :www
COMMAND  PID     USER   FD   TYPE DEVICE SIZE NODE NAME
nginx   1470     root    6u  IPv4 297609       TCP *:http (LISTEN)
nginx   1470     root    7u  IPv6 297610       TCP *:http (LISTEN)
nginx   1471 www-data    6u  IPv4 297609       TCP *:http (LISTEN)
nginx   1471 www-data    7u  IPv6 297610       TCP *:http (LISTEN)
nginx   1472 www-data    6u  IPv4 297609       TCP *:http (LISTEN)
nginx   1472 www-data    7u  IPv6 297610       TCP *:http (LISTEN)
nginx   1473 www-data    6u  IPv4 297609       TCP *:http (LISTEN)
nginx   1473 www-data    7u  IPv6 297610       TCP *:http (LISTEN)
nginx   1474 www-data    6u  IPv4 297609       TCP *:http (LISTEN)
nginx   1474 www-data    7u  IPv6 297610       TCP *:http (LISTEN)
root@mycontainer:~# logout
$ lxc list mycontainer
+-------------+---------+--------------------+------+-----------+-----------+
|    NAME     |  STATE  |        IPV4        | IPV6 |   TYPE    | SNAPSHOTS |
+-------------+---------+--------------------+------+-----------+-----------+
| mycontainer | RUNNING | 10.10.10.92 (eth0) |      | CONTAINER | 0         |
+-------------+---------+--------------------+------+-----------+-----------+
$ curl 10.10.10.92
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
...
$ lxc stop mycontainer
$ lxc delete mycontainer

Just like with VMs, you can also get the system container to get an IP address from the LAN. And many other things, much more lightweight than with virtual machines.