Unable to install fleet managed elastic agent

Hi,

I am having trouble installing the fleet managed elastic agent for Linux into one of our Docker containers, which has a Linux-Alpine base image. I have elastic-cloud setup with fleet running. I have managed to install an elastic agent with the DEB steps with one container that is running Redis (Deb base image) and that all connects fine just so you know.

For the Linux steps to install the elastic agent:
Step 1. Works fine:
curl -L -O https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-7.13.0-linux-x86_64.tar.gz
tar xzvf elastic-agent-7.13.0-linux-x86_64.tar.gz

Step 2. I can only manage to cd in to the directory before getting an error message on the final command:
cd elastic-agent-7.13.0-linux-x86_64
sudo ./elastic-agent install -f --url=<fleet_server_url> --enrollment-token=<enrollment_token>

Error message received after running sudo command:
bash-5.1# sudo ./elastic-agent install -f --url=<fleet_server_url> --enrollment-token=<enrollment_token>
sudo: unable to execute ./elastic-agent: No such file or directory

I saw that the sudo command "requires a system and service manager like systemd."

  • So I added openrc to the image and got the same issue - Though I wasn't sure if I was required to configure openrc because my knowledge is limited with that.

I also double checked elastic-agent was in the directory..:
bash-5.1# ls
LICENSE.txt README.md elastic-agent elastic-agent.yml
NOTICE.txt data elastic-agent.reference.yml

Permissions also look fine:
bash-5.1# ls -l
-rw-r--r-- 1 root root 13675 May 20 00:54 LICENSE.txt
-rw-r--r-- 1 root root 8576604 May 20 00:54 NOTICE.txt
-rw-r--r-- 1 root root 863 May 20 01:02 README.md
drwxr-xr-x 1 root root 4096 Jun 2 11:55 data
lrwxrwxrwx 1 root root 39 Jun 2 11:55 elastic-agent -> data/elastic-agent-054e22/elastic-agent
-rw-r--r-- 1 root root 9020 May 20 00:55 elastic-agent.reference.yml
-rw------- 1 root root 9017 May 20 00:55 elastic-agent.yml

I have tried to troubleshoot myself, but I am relatively new to the world of Elastic / Docker so any support you can provide to get this working would be greatly appreciated!

Thanks

The binary is not statically linked (has not all the necessary libraries). If you want the Elastic Agent in an Alpine based Docker image, you will have to compile the binary yourself.

I suggest strongly to use the official image docker.elastic.co/beats/elastic-agent:7.13.1.

Please use the Elastic Stack > Beats space for Elastic Agent related questions. This space is dedicated to discuss about Elastic Cloud on Kubernetes (ECK).

1 Like