Ronan Cunningham
Ronan Cunningham

Reputation: 201

Docker compose - secrets Additional property secrets is not allowed

docker-compose --version docker-compose version 1.11.1, build 7c5d5e4

I have secret 'my_secret_data' added to my swarm cluster:

The start of my compose file looks like:

version: "3.1"
secrets:
  my_secret_data:
    external: true
services:
  master:
    image: jenkins-master
    secrets:
     - my_secret_data
    ports:
     - "8080:8080"
     - "50000:50000" 

'docker stack deploy' continually gives the error:

secrets Additional property secrets is not allowed

I have followed how do you manage secret values with docker-compose v3.1? to the letter as far as I can tell and have the correct versions installed but keep getting the above error. Any help greatly appreciated.

Upvotes: 20

Views: 19916

Answers (3)

Amar Singh
Amar Singh

Reputation: 21

In my case, Service: had an extra tab prior. Moment I removed tab prior to it, it worked.

Upvotes: 2

JeremyDouglass
JeremyDouglass

Reputation: 1481

The "Additional property secrets is not allowed" error can be caused either by:

  1. running Docker Engine < 1.13.1, or
  2. using a compose file version number < '3.1' in a docker-compose file such as docker-compose.yml or docker-cloud.yml

If you are experiencing this problem confirm that both are correct.

This also applies to other Docker interfaces and tools.

For examples, in Portainer, yml with secrets lines pasted into the Create Stack dialog should begin with the line version: '3.1' or you will encounter the same error -- even with an up-to-date Docker Engine 1.13.1+.

Upvotes: 6

Arman
Arman

Reputation: 1059

Change compose file version to latest version.

In short, version '3' is not resolved to the latest '3.x' version. Find what the latest version is here https://docs.docker.com/compose/compose-file/#compose-and-docker-compatibility-matrix

Upvotes: 15

Related Questions