使用docker-compose创建超级用户

huangapple go评论113阅读模式
英文:

Creating a super use with docker-compose

问题

我尝试使用以下命令来创建超级用户,但一直收到错误消息:

docker-compose -f docker-compose-deploy.yml run --rm app sh -c "python manage.py createsuperuser"

错误信息是:Error response from daemon: No such container: 3316a457be585979396635f940978c6942eaf969da69f7f86fc4dba6375fd923

然而,当我运行 docker ps 时,没有列出任何容器。如何避免这个错误?

英文:

Am new to docker and am trying to create a super user using this command:

docker-compose -f docker-compose-deploy.yml run --rm app sh -c "python manage.py 
createsuperuser"

I keep getting Error response from daemon: No such container: 3316a457be585979396635f940978c6942eaf969da69f7f86fc4dba6375fd923

However, when I ran docker ps, There are no containers listed.
How do I avoid this error?

答案1

得分: 1

请尝试运行以下命令,确保已删除容器或更改了其名称:

docker-compose run --rm app sh -c "python manage.py createsuperuser"

另外,请确保在您的 docker-compose.yml 文件中定义了 app 服务。

英文:

Double check if you removed the container or changed its name. Try to run:

docker-compose run --rm app sh -c "python manage.py createsuperuser"

instead.

Also make sure you defined the app service in your docker-compose.yml.

huangapple
  • 本文由 发表于 2023年3月9日 18:15:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683190.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定