How to exit from the container after executing one script inside it

docker exec -it --user oracle cxo /bin/sh -c "perl /tmp/add.pl;exit"

Update idcs test mode true to /application-optional.properties

File updated!!

Note: Above cmd is not exiting from the docker container and hangs there.

Source: StackOverflow