djangopostgresqldockerdocker-compose

Getting error "Error getting credentials - err: exit status 1, out : ``" when trying to build on my mac but in ubuntu everything looks good


When it was trying to build on my Mac, the following issue occurred "Error getting credentials - err: exit status 1, out:"

When I was building the Django project on my Mac.

The following issue is occurring.

sudo docker-compose -f docker-compose.dev.yml up -d --build
Password:
WARN[0000] The "hl0" variable is not set. Defaulting to a blank string. 
WARN[0000] The "hl0" variable is not set. Defaulting to a blank string. 
WARN[0000] The "hl0" variable is not set. Defaulting to a blank string. 
WARN[0000] The "hl0" variable is not set. Defaulting to a blank string. 
2023/05/21 14:09:08 must use ASL logging (which requires CGO) if running as root
[+] Running 0/0
 ⠋ db Pulling                                                              0.0s
error getting credentials - err: exit status 1, out: ``

My docker-compose :

version: "3.3"

services:
  db:
    image: postgres:14.0-alpine
    environment:
      POSTGRES_USER: ${SQL_USER}
      POSTGRES_PASSWORD: ${SQL_PASSWORD}
      POSTGRES_DB: ${SQL_DATABASE}
    volumes:
      - rbn_db:/var/lib/postgresql/data
    networks:
      - rbn
  web:
    build: ./
#    command: gunicorn monsite.wsgi:application --bind 0.0.0.0:8000
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - ./:/code
    ports:
      - "9005:8000"
    env_file:
      - ./.env
    depends_on:
      - db
    networks:
      - rbn
volumes:
  rbn_db:

networks:
  rbn:
    driver: bridge

.env file :

DEBUG=1
SECRET_KEY=secret_key
DJANGO_ALLOWED_HOSTS=localhost;127.0.0.1
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=database
SQL_USER=database_user
SQL_PASSWORD=database_password
SQL_HOST=db
SQL_PORT=5432
DJANGO_DEBUG=True

Solution

  • Try editing ~/.docker/config.json and replacing "credsStore": "desktop" with "credsStore": "osxkeychain".