# Elastic Agent by Docker Image

**URL:** <https://discuss.elastic.co/t/elastic-agent-by-docker-image/338636>\
**Category:** Elastic Agent\
**Created:** [July 18, 2023, 8:56am UTC](https://discuss.elastic.co/t/elastic-agent-by-docker-image/338636 "2023-07-18T08:56:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Retrogamer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/retrogamer/32/123537_2.png) [@Retrogamer](https://discuss.elastic.co/u/Retrogamer)\
**Post date:** [July 18, 2023, 8:56am UTC](https://discuss.elastic.co/t/elastic-agent-by-docker-image/338636/1 "2023-07-18T08:56:05Z")

</div>

I want to deploy Stand-alone Elastic Agent using Docker image. I followed the instruction in this [page](https://www.elastic.co/guide/en/fleet/current/elastic-agent-container.html#_step_4_run_the_elastic_agent_image) but, I am not sure which environment variables I should use to deploy the Agent as Stand-alone. Elastic Search and Kibana 8.8.1 both running on Docker on the same host, an Ubuntu 22.4 LTS.

However, I tried starting the Agent's container with Fleet Server and thought below script will also add the Fleet Server. But it seems that is not the case, correct?

```auto
docker run --name elastic_agent --net elastic_net 
--env FLEET_SERVER_ENABLE=true 
--env FLEET_SERVER_ELASTICSEARCH_HOST=https://172.19.0.2:9200 
--env FLEET_SERVER_SERVICE_TOKEN=some_hash 
--env FLEET_SERVER_POLICY_ID='postgres_agent_1' 
-p 8220:8220 
-it docker.elastic.co/beats/elastic-agent:8.8.1

```

So, after running, this is part of the error log:

```auto
{"log.level":"error","@timestamp":"2023-07-17T16:25:01.989Z","log.origin":{"file.name":"coordinator/coordinator.go","file.line":978},"message":"Unit state changed fleet-server-default (STARTING->FAILED): Error - tls: failed to verify certificate: x509: certificate signed by unknown authority","log":{"source":"elastic-agent"},"component":{"id":"fleet-server-default","state":"HEALTHY"},"unit":{"id":"fleet-server-default","type":"output","state":"FAILED","old_state":"STARTING"},"ecs.version":"1.6.0"}

```

But I can not add the certificate because there is no Fleet Server.

So does this mean, that I need to first add Fleet Server using normal TAR / RPM, and then I can add Agents to it (from other hosts) - either by Container or package?

And in case, I want to run the Agent's container as Stand-alone, what env I should use on Docker run command?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 15, 2023, 8:56am UTC](https://discuss.elastic.co/t/elastic-agent-by-docker-image/338636/2 "2023-08-15T08:56:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
