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

  • Why https is forced?
  • Increase Disk Space on Docker Toolbox
  • Create container from local file
  • Kubernetes: how to use gitRepo volume?
  • What is the docker daemon version on Vagrant provisioner?
  • Docker. Does restart container means the same as restart process from CMD instruction?
  • 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.

  • Dockerfile CMD instruction will exit the container just after running it
  • Restoring a local pg_dumpall in a docker container
  • xhost command for docker GUI apps (Eclipse)
  • Docker-compose up directory error with Python3
  • redirect log files created in a docker container to stdout / stderr
  • boot2docker can't access the outside world
  • 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.