How to fix lxc ‘Error: The remote isn’t a private LXD server’

Problem:

You want to launch a lxc container using lxc launch, but you get this error message instead:

Error: The remote isn't a private LXD server

Solution:

You are using a command like this:

lxc launch mycontainer ubuntu:18.04

You’ve swapped the container name and image arguments! The correct command looks like this:

lxc launch ubuntu:18.04 mycontainer