'django-cookiecutter, docker-compose run: can't type in terminal

I'm having an issue with a project started with django cookiecutter.

To verify that the issue was not with my project, I'm testing on a blank django cookiecutter project.

The issue is that when I run:

docker-compose -f production.yml run --rm django python manage.py createsuperuser

I get the prompt but can't type in the terminal.

Same thing when I run:

docker-compose -f production.yml run --rm django python manage.py shell

I get the shell prompt, but I can't type.

The app is running on a machine on DigitalOcean created with the docker-machine create command.

Any thoughts on what the issue could be and how I could debug this?



Solution 1:[1]

to enable typing in docker-compose terminal, you need to specify the terminal session is interactive on the docker-compose.yml. Because by default, docker console is not interactive.

stdin_open: true
tty: true  

Solution 2:[2]

bash can be accessed inside the docker container using the following command.

docker-compose -f production.yml exec django bash

This will give you full access to the container of your django server. There you can run all your normal django commands with full interactivity.

Create Superuser

python manage.py createsuperuser

For Local ENV

docker-compose -f local.yml exec django bash

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 abdadeel