Django shell mode in docker

I am learning how to develop Django application in docker with this official tutorial:

I have successfully run through the tutorial, and

  • Go-compiled binary won't run in an alpine docker container on Ubuntu host
  • docker_gwbridge collision is possible?
  • Running Odoo behind nginx with docker
  • Kubernetes pod can't access its own service
  • Setting up private docker registry with a frontend
  • Akka Cluster with bind-port and bind-hostname
  • docker-compose run web startproject composeexample . creates the image
    docker-compose up runs the application

    The question is:

    I often use python shell to run Django in shell mode, but I do not know how to achieve that with docker.

  • How to create --link for 2 containers to link to each other?
  • inotifywait with Docker command and variable
  • Setting build args for dockerfile agent using a Jenkins declarative pipeline
  • Docker Swarm with etcd
  • Gitlab cross project dependency - python
  • launching adhoc docker instances: Is it recommended to launch a docker instance per request?
  • One Solution collect form web for “Django shell mode in docker”

    1. Run docker exec -it --user desired_user your_container bash
      Running this command has similar effect then runing ssh to remote server – after you run this command you will be inside container’s bash terminal. You will be able to run all Django’s commands.
    2. Inside your container just run python shell
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.