I'm using Xephyr on an LXD container and this is the autostart script:
#!/bin/sh
lxc start debian
lxc exec debian -- Xephyr -screen 1366x768 :1& #Xephyr display :1 window opens in :0 running on host
lxc exec debian -- sh -c 'DISPLAY=:1 i3'
lxc stop debian
The socket /tmp/.X11-unix/X1
inside the container isn't present when Xephyr is launched from this script but is when each of the commands are invoked manually one after another.