Saving this so I don’t have to find this again.
Context – this is for enabling docker to start on boot of a EC2 virtual machine using Amazon Linux 2.
Apparently I had to not only enable the systemctl service – but also flip a flag for “enable lingering” – found via an obscure Stack Exchange link?
I must be doing something wrong here – it just doesn’t sound correct to have to “enable a lingering” login session.
Commands I used that worked are as follows:
#Enable Docker on Boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
#Enable Lingering on loginctl
loginctl enable-linger $USER
Credit at the below Stack Exchange Links:
- systemctl does not restart the service until ssh to the AWS instance

- loginctl enable-linger/disable-linger … but reading linger-status?