Those look different than any fungus gnat I've seen, but if they are, they will eat your roots and cause them to rot. You can get mosquito dunks for like $5 at Lowe's or any garden store. I think even if you are in soil, if you get the dunk wet it will still eat the gnat eggs. You have to break the life cycle or you will be plagued with them forever. You could also try No Pest Strips, but I am not sure if they are a reliable method of treating fungus gnat infestations.