티스토리 뷰

서론

Django 프로젝트의 Docker 컨테이너에서 슈퍼유저를 생성하는 방법을 소개합니다.

본론

Dockerfile에서 오류

Docker Image로 만들 때 createsuperuser 를 실행하려고 하면 아래와 같은 에러가 발생합니다.

ex) echo "example/example@example.com/password/password" | python manage.py createsuperuser

Superuser creation skipped due to not running in a TTY. You can run manage.py createsuperuser in your project to create one manually.

위 문장에서도 나와 있듯 수동으로만 슈퍼 유저를 생성할 수 있도록 보안정책을 만들어 둔 것 같습니다.

docker exec 활용하기

이미지들이 올라와 있을 때 아래 명령어를 통해 createsuperuser를 실행할 수 있습니다.

docker exec -it <container-name> python manage.py createsuperuser

결론

자동만으로는 안되는 것이 있다는 것을 새삼 느낍니다.

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/11   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
글 보관함