18

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.

Community
  • 1
  • 1
Ronan Cunningham
  • 181
  • 1
  • 1
  • 3

3 Answers3

14

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

Victor Häggqvist
  • 4,484
  • 3
  • 27
  • 35
Arman
  • 1,019
  • 2
  • 14
  • 33
6

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+.

JeremyDouglass
  • 1,361
  • 2
  • 18
  • 31
1

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

Amar Singh
  • 11
  • 1