Home > Enterprise >  Additional property port is not allowed in docker compose
Additional property port is not allowed in docker compose

Time:09-22

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

CodePudding user response:

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
  • Related