python won't keep running after giving it a command

I’m trying to keep my python container running in the background. I’m currently using the following command…

docker container run -d --name pythoncon -p 9000:9000 python:3.8-slim \
  python3 -m http-server 9000

but it will keep on closing instead of running in the background. I’m pretty new to docker but I understand that the -it flag would give interactive but passing that command and running with -d should keep it running without the -it flag right?

Thank you for any assistance/advice given

It has nothing to do with Docker. Just use the correct python module name which is http.server not http-server. It should be in the container logs too.

2 Likes

That did it, thank you soo much! I really appreciate it!