Elastic-agent in a docker container

Hi all.

Im trying to run an elastic-agent inside a docker container and im encountering a few issues. I know that docker isnt technically supported however I think im nearly there and im going to persevere with it.

I have the elastic-agent (from the elastic repository) running atop of a debain image.

elastic-agent enroll -f --url={URL}:8220 --enrollment-token={TOKEN} --insecure --path.config=/etc/elastic-agent -v -e

successfully enrolls and makes the agent appear in fleet as updating.

service elastic-agent --full-restart

makes the agent go from updating to unhealthy

and this is as far as I have got.

No matter what I do,

elastic-agent status

returns
Error: failed to communicate with Elastic Agent daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial unix /var/lib/elastic-agent/data/tmp/elastic-agent-control.sock: connect: no such file or directory"

and

 elastic-agent inspect 

returns
no fleet config retrieved yet

What you are doing inside of docker is not supported. You should use the supported Elastic Agent docker container.