6

I have a issue with this code. When i write in terminal docker-compose up --build. Terminal show me this issue:

C:\Users\ingbr\OneDrive\Documentos\Server Minecraft> docker-compose up --build
services.minecraft-server Additional property args is not allowed

I don't find a solution

version: "3"

services:
  minecraft-server:
    build:
     context: .
    args:
      RAM_AMOUNT: ${RAM_AMOUNT} 
    volumes:
       - .server-data:/server
    ports:
          - 25565:25565
          - 25575:25575
    container_name: ${CONTAINER_NAME}
          
volumes:
    server-data:
Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45
Bryan Arauz
  • 61
  • 1
  • 2
  • 8
    `args` needs to be put under `build` as can be seen here: https://docs.docker.com/compose/compose-file/compose-file-v3/#args – Julia Apr 17 '22 at 18:25
  • I found that solution on StackOverflow: https://stackoverflow.com/questions/43566427/docker-compose-file-not-working-replicas-additional-property-replicas-is-not-al I hope it works. – iTzVoko Apr 17 '22 at 18:25
  • 1
    Also note that a dot in this line: `- .server-data:/server` means local folder instead of named volume. Do you want to use a named volume or a bind mount? Try running `docker-compose config` to see the difference in the parsed configuration with and without the dot. – Janez Kuhar Apr 17 '22 at 18:40

1 Answers1

2

The "args" is one of "build" parameters, so your script should be like:

version: "3"

services:
  minecraft-server:
    build:
     context: .
     args:
       RAM_AMOUNT: ${RAM_AMOUNT} 
    volumes:
       - .server-data:/server
    ports:
          - 25565:25565
          - 25575:25575
    container_name: ${CONTAINER_NAME}
          
volumes:
    server-data:
Shessuky
  • 1,846
  • 21
  • 24