错误:无法访问PostgreSQL,仓库不存在或可能需要“docker login”:拒绝访问所请求的资源。

4

在学习使用 Django 进行 Docker 时,我遇到了在 Linux Mint 中安装 PostgreSQL 的一些问题。

这是来自文件 docker-compose.yml 的代码:

version: '3.7'

services: 
    web:
        build: .
        command: python /code/manage.py runserver 0.0.0.0:8000
        volumes: 
            - .:/code
        ports: 
            - 8000:8000
        depends_on: 
            - db

    db:
        image: postgress:11

我收到的错误信息是在执行 docker-compose up -d 命令时。
Pulling db (postgress:)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Continue with the new image? [yN]y
Pulling db (postgress:)...
ERROR: pull access denied for postgress, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

在使用 Docker 登录后,仍会出现此错误。

1个回答

8
我认为这与docker-login无关,而是您在镜像名称中存在一个错别字,应该是postgreSQL:11(多了一个)。请参见:https://hub.docker.com/_/postgres。更新的compose文件如下。
version: '3.7'

services: 
    web:
        build: .
        command: python /code/manage.py runserver 0.0.0.0:8000
        volumes: 
            - .:/code
        ports: 
            - 8000:8000
        depends_on: 
            - db

    db:
        image: postgres:11

我也犯了同样的错误,谢谢。 - Partha Paul

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接