Docker & Postgres: Failed to bind tcp 0.0.0.0:5432 address already in use

后端 未结 5 1087
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-30 22:38

Problem

I\'m trying to start postgres in a docker container on my Mac, but I keep getting the following error message

docker: Error response from da

5条回答
  •  后悔当初
    2021-01-30 23:04

    Go to project and click on docker-compose.yml

    version: '2'
    services:
        web:
            build: .
            ports: 
                - "8000:8000"
            volumes: 
                - .:/app
            links: 
                - db
                - mail-server
        db:
            image: "postgres"
            environment: 
                POSTGRES_PASSWORD: hunter2
            ports:
                - "5432:9432"
        mail-server:
            image: "mailhog/mailhog"
            expose: 
                - 1025
            ports: 
                - "8026:8026"
    

    " change the ports to 8026:8026 because there is already running another container on this port number only change the port number"

提交回复
热议问题