How to make a sh file to run docker image first, then continue running another .sh file without user interaction? [closed]

  bash, docker

I need to write a sh file, which will be executed under ssh connection.

It needs to run a docker image first, then move to a specified path to execute another sh file. All the operation must be proceed without any user interaction.

my original design is like


run docker image (I also try to use source, but same result)

cd ~/test


but it will pause after run docker image. If I type exit, then it exit docker shell, and keep executing following commands. But without docker running, can not run successfully.

How can I solve it? My target is to run this sh file under ssh connection, without any user interaction involved.

Source: Docker Questions