Replace the file in the docker image

I have built the docker image by copying the file into the docker image like below

FROM docker.elastic.co/beats/filebeat:7.8.0
COPY filebeat.yml /usr/share/filebeat/filebeat.yml

Docker image is successfully built and it is working as expected.

Now I have the use case to replace the ‘filebeat.yml’ located in the ‘/usr/share/filebeat/filebeat.yml’ when I run the docker run command,
What is the correct way to do this?

Thanks,
Harry

Source: StackOverflow