인프런 커뮤니티 질문&답변

현석오님의 프로필 이미지
현석오

작성한 질문수

따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)

도커를 이용한 Postgres 실행

docker-compose up 명령어 날리면 에러 발생

작성

·

1.1K

0

에러 내용이 아래와 같은데 조취 방법좀 알려주세요

 

질문 두가지는 현재 docker 는 설치 되있긴 한데 docer-compose 는 설치 된건지 모르겠고 .env 유저 아이디와 비밀번호는 .env 에 임의로 설정하면 되나요?

 

.env:

DB_USER_ID=postgres
DB_USER_PASSWORD=1234

 

docker-compose.yml:

version: '3'
services:
    db:
      image: postgres:latest
      container_name: postgres
      restart: always
      ports:
        - "5432:5432"
      environment:
        POSTGRES_USER: ${DB_USER_ID}
        POSTGRES_PASSWORD: ${DB_USER_PASSWORD}
      volumes:
        - ./data:/var/lib/postgresql/data

 

실행 test

(base) sizl@sizlui-MacBookPro server % docker-compose up
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 670, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1255, in request
  File "http/client.py", line 1301, in _send_request
  File "http/client.py", line 1250, in endheaders
  File "http/client.py", line 1010, in _send_output
  File "http/client.py", line 950, in send
  File "docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "requests/adapters.py", line 439, in send
  File "urllib3/connectionpool.py", line 726, in urlopen
  File "urllib3/util/retry.py", line 410, in increment
  File "urllib3/packages/six.py", line 734, in reraise
  File "urllib3/connectionpool.py", line 670, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1255, in request
  File "http/client.py", line 1301, in _send_request
  File "http/client.py", line 1250, in endheaders
  File "http/client.py", line 1010, in _send_output
  File "http/client.py", line 950, in send
  File "docker/transport/unixconn.py", line 43, in connect
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker/api/client.py", line 214, in _retrieve_server_version
  File "docker/api/daemon.py", line 181, in version
  File "docker/utils/decorators.py", line 46, in inner
  File "docker/api/client.py", line 237, in _get
  File "requests/sessions.py", line 543, in get
  File "requests/sessions.py", line 530, in request
  File "requests/sessions.py", line 643, in send
  File "requests/adapters.py", line 498, in send
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 81, in main
  File "compose/cli/main.py", line 200, in perform_command
  File "compose/cli/command.py", line 60, in project_from_options
  File "compose/cli/command.py", line 152, in get_project
  File "compose/cli/docker_client.py", line 41, in get_client
  File "compose/cli/docker_client.py", line 170, in docker_client
  File "docker/api/client.py", line 197, in __init__
  File "docker/api/client.py", line 221, in _retrieve_server_version
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
[65638] Failed to execute script docker-compose

답변 1

0

John Ahn님의 프로필 이미지
John Ahn
지식공유자

안녕하세요 현석오 님

지금 경로를 보면 server 디렉터리에서 명령어를 작성해주시고 있는데

프로젝트의 루트 디렉터리로 가서 cd../

다시 명령어 작성해서 시도해보시겠어요?

감사합니다.

현석오님의 프로필 이미지
현석오

작성한 질문수

질문하기