run docker image process in the background then stop it

You can run the docker image as a background process by running the -d option.

root@computer:~/docker# docker run -d -p 8080:80 imagename
b35744d7cba1ebb4ae2c5d65105c46eda4fdffac6136448c5ceabe18900c217d

You can list the container in docker using

root@computer:~/docker# docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                  NAMES
b35744d7cba1        imagename           "python app.py"     14 seconds ago      Up 13 seconds       0.0.0.0:8080->80/tcp   stupefied_liskov

And you can stop the docker image using the stop function and container id

root@computer:~/docker# docker stop b35744d7cba1
b35744d7cba1

You should no longer see it running

root@computer:~/docker# docker container ls
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES