you can run commands inside a running container using docker exec -it {container_id} /bin/bash.
It will create a bash for you that you can run commands with. but generally it's not a good practice to have modifications on image states since it removes the portability of images.