As the title says, what’s the difference? I don’t understand the difference between the two? By VM do you mean Fly VMs are full-fledged KVM machines?
Yes, they are full-fledged KVM machines.
They have their own kernel and share nothing with the host.
We have our own init
program (PID 1) to make things easier for Docker images which often don’t include one.
@jerome How do I deploy a VM instead of a Docker app?
All Fly instances are VMs, none of them are docker containers. We just extract the Docker image to the root drive of the VM.
Launching an app or a Fly Machine will get your a VM. The latter is more flexible.
@jerome In that case I launched Ubuntu container and installed openssh-server but in the VM I can’t install LXC for example
Here is my Dockerfile:
FROM ubuntu
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:mypassword' | chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
RUN mkdir /root/.ssh
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]
What commands are your using and what error are you getting when trying to install LXC?
@jerome Is it possible to deploy a bare VM?
@jerome This is the error I’m getting
root@a28992a0:~# snap install lxd
error: cannot communicate with server: Post http://localhost/v2/snaps/lxd: dial unix /run/snapd.socket: connect: no such file or directory
Running a Docker image like you’re doing is pretty much as bare as it gets.
Looks like you need to run the snapd server in the background first.
There’s no systemd
running in these VMs. There’s no systemd
included in the Ubuntu docker images anyway. It looks like the easiest way to use snaps is to use systemd
.
You might be able to make it work by running snapd &
and then retrying.
However, it’s likely easier to use aptitude:
apt update
apt install lxc
# ...
Instructions here: https://ubuntu.com/server/docs/containers-lxc
@jerome
Nope
Command '/usr/bin/lxd' requires the lxd snap to be installed.
Please install it with:
snap install lxd
Is it not possible to deploy a VM that has systemd included? Or maybe a way just to deploy a bare VM?
All our VMs require a Docker-like image. The “barest” would be using the Docker scratch
image, but you wouldn’t be able to do anything with it.
We always include our own init
program as PID 1 because 99.9% of Docker images don’t include a useful PID 1 program (reaping zombies and all that).
Our init
also does more, like collecting metrics, forwarding logs, etc.
I’m sure you can run systemd
as something other than PID 1, but you’ll have to figure that out yourself. We can only help so much.
You can install lxd
without snap: apt install lxd
.
You’ll have to do more troubleshooting on your own, we can’t hold your hand through every command you run. I know nothing about LXC and only had to do 2 Google searches to figure out how to run it without snap.
I don’t want it either. I never didn’t ask for hand-holding.
I installed lxd with apt. But running “lxd init” errors out that it requires the snap package.
Anyways, thank you for your efforts