Docker on macOS at native speed using Ubuntu Virtual Machine (both Intel and Apple Silicon CPU) | by Jan Mikeš | Carvago Development | Medium

PHOTO EMBED

Thu Mar 10 2022 23:47:39 GMT+0000 (Coordinated Universal Time)

Saved by @phutti_wat #bash

mkdir /mnt
mount /dev/vda /mnt
chroot /mnt

touch /etc/cloud/cloud-init.disabled

echo 'root:root' | chpasswd

ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519

cat <<EOF > /etc/netplan/01-dhcp.yaml 
network:
    version: 2
    ethernets:
        enp0s1:
            dhcp4: true
            addresses: [192.168.64.2/24]
            nameservers:
                addresses: [8.8.8.8, 8.8.4.4]    
EOF

exit
umount /dev/vda
content_copyCOPY

Setup Ubuntu focal headless with root user root password and setup connection

https://medium.com/carvago-development/my-docker-on-macos-part-1-setup-ubuntu-virtual-machine-both-intel-and-apple-silicon-cpu-5d886af0ebba