skip to Main Content

I try to debug an app inside of the container and I need to run django to run tests I do that by:

docker-compose exec django bash

But as a result I get:

service "django" is not running container #1

I don’t really understand what this response means and I didn’t find any information regarding that. This issue prevents me from being able to debug a code inside of the container with the database up and running.

3

Answers


  1. Try to add in settings.py:

    ALLOWED_HOSTS = ['*']
    

    and

    Debug = True
    
    Login or Signup to reply.
  2. if docker ps show a container name "django"
    then run if you want to get bash prompt in:

    docker exec -ti django bin/bash
    

    if bash not available you can try bin/sh

    if container isn’t running you can’t go in.

    Login or Signup to reply.
  3. I think you should check docker-compose.yaml

    You wrote it:

    docker-compose exec django bash 
    

    Try this:

    version: '3'
    
    services:
      web: # check
        container_name: django
    
    docker-compose exec -it web /bin/bash 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search