docker exec -i <container_name> <command>
Meaning: Runs the command in interactive mode. Usage: Keeps STDIN open for the command. Example: docker exec -i my-container cat /etc/hosts shows the contents of /etc/hosts in my-container.
docker exec -i my-container cat /etc/hosts
/etc/hosts
my-container