etranz
etranz

Reputation: 1253

Additional property port is not allowed in docker compose

I am trying to run my docker-compose.yaml file on aws ec2 instance but I keep getting this error

services.postgres Additional property port is not allowed

My YAML file

version: "3.8"
services:
    java-maven-app:
        image: oshabz/docker-demo:1.1.0-25
        ports:
            - 8080:8080
    postgres:
        image: postgres:13
        port:
            - 5432:5432
        environment:
            - POSTGRES_PASSWORD=my-pwd

Upvotes: 0

Views: 5042

Answers (1)

neonwatty
neonwatty

Reputation: 346

You need to use the property ports not port - as you have done with the java-maven-app service. So your postgres service should look like (use ports not port)

    postgres:
        image: postgres:13
        ports:
            - 5432:5432
        environment:
            - POSTGRES_PASSWORD=my-pwd

Upvotes: 4

Related Questions