# Clear data from influxdb

**URL:** <https://community.influxdata.com/t/clear-data-from-influxdb/20879>\
**Category:** InfluxDB 2\
**Tags:** influxdb\
**Created:** [July 23, 2021, 2:35pm UTC](https://community.influxdata.com/t/clear-data-from-influxdb/20879 "2021-07-23T14:35:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samurai](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@samurai](https://community.influxdata.com/u/samurai)\
**Post date:** [July 23, 2021, 2:35pm UTC](https://community.influxdata.com/t/clear-data-from-influxdb/20879/1 "2021-07-23T14:35:24Z")

</div>

Hello There,

I am new to influxdb, can you please let me know how I can remove data from measurement from influxdb hosted in docker container like below.

docker exec -it influxpod – influx {clear data from measurement }

please help me how I can don this, yes we are working on API part but it will be helpful if I get some guidance for above command.

Regards,  
Samurai

---

<div class="post-metadata">

**Author:** ![wbaker](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/wbaker/32/7481_2.png) [@wbaker](https://community.influxdata.com/u/wbaker)\
**Post date:** [July 23, 2021, 8:06pm UTC](https://community.influxdata.com/t/clear-data-from-influxdb/20879/2 "2021-07-23T20:06:10Z")

</div>

You should be able to use the standard CLI commands with the Docker container, there’s some documentation on how to delete data here: [influx delete | InfluxDB OSS 2.0 Documentation](https://docs.influxdata.com/influxdb/v2.0/reference/cli/influx/delete/)

Just as a quick example, a command like this should work, assuming you have a config setup with your token. There are other configuration options you’ll want to take a look at in the delete docs:

```auto
docker exec -it influx_container_name influx delete --org org --bucket bucket --start 2009-01-02T23:00:00Z --stop 2009-01-03T23:00:00Z

```

---

<div class="post-metadata">

**Author:** ![samurai](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@samurai](https://community.influxdata.com/u/samurai)\
**Post date:** [July 26, 2021, 7:55am UTC](https://community.influxdata.com/t/clear-data-from-influxdb/20879/3 "2021-07-26T07:55:33Z")

</div>

Thank you wbaker

can you help if we can delete specific measurement from host in influxdb container like below

docker exec -it influx\_container\_name influx DROP measurement workers

if yes where and how I can provide db name in above command,

also is there any way to store only latest data I can see if I trigger queries it gets duplicated records with new time stamp for example

1123 worker new-timestamp  
1123 worker old-timestamp

because of this I am planning to remove data first and insert new each time when my script is executed.

Please guide.

Regards,  
Samurai

---

<div class="post-metadata">

**Author:** ![wbaker](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/wbaker/32/7481_2.png) [@wbaker](https://community.influxdata.com/u/wbaker)\
**Post date:** [July 26, 2021, 4:26pm UTC](https://community.influxdata.com/t/clear-data-from-influxdb/20879/4 "2021-07-26T16:26:44Z")

</div>

To delete specific data like data with a certain measurement, you can use the `--delete` flag to specific a predicate. There are some examples at [influx delete | InfluxDB OSS 2.0 Documentation](https://docs.influxdata.com/influxdb/v2.0/reference/cli/influx/delete/#examples) which illustrate what you are wanting to do.
