Issue type
Can’t use Docker Secrets with Docker Compose 2.2.3 without creating a swarm
OS Version/build - Docker
Client: Docker Engine - Community
Version: 20.10.13
API version: 1.41
Go version: go1.16.15
Git commit: a224086
Built: Thu Mar 10 14:07:51 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.13
API version: 1.41 (minimum version 1.12)
Go version: go1.16.15
Git commit: 906f57f
Built: Thu Mar 10 14:05:44 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.5.10
GitCommit: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
runc:
Version: 1.0.3
GitCommit: v1.0.3-0-gf46b6ba
docker-init:
Version: 0.19.0
GitCommit: de40ad0
OS Version/build - Docker Compose’’
Docker Compose version v2.2.3
Steps to reproduce
1.) Install docker-rootless & docker-compose according to documentation on ubuntu 20.04.4
2.) Then execute:
$ echo "nextcloud" | docker secret create mysql_database -
Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again.
Based on reading, I thought that with Docker Compose 1.11 above that you can specify secrets in your Docker Compose without using Swarm.
Is this a limitation of running docker compose with docker-rootless? If it is not, How do I generate secrets? to be used in docker-compose.yml?
thanks
my current yaml:
version: '3.9'
secrets:
mysql_password:
external: true
mysql_user:
external: true
mysql_database:
external: true
mysql_root_password:
external: true
redis_host_password:
external: true
# smtp_password:
# external: true
volumes:
nextcloud:
mariadb:
redis:
phpmyadmin:
services:
mariadb:
image: mariadb:latest
secrets:
- mysql_root_password
- mysql_password
- mysql_database
- mysql_user
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- ./mariadb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
- MYSQL_PASSWORD=/run/secrets/mysql_password
- MYSQL_DATABASE=/run/secrets/mysql_database
- MYSQL_USER=/run/secrets/mysql_user
networks:
- test-aym
phpmyadmin:
image: phpmyadmin:latest
secrets:
- mysql_root_password
restart: always
ports:
- 8081:80
environment:
- PMA_HOST=mariadb
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
networks:
- test-aym
redis:
image: redis:6.2-alpine
restart: always
volumes:
- ./redis/redis-conf:/var/lib/redis
- ./redis/cache:/data
networks:
- test-aym
app:
image: nextcloud
restart: always
ports:
- 8080:80
depends_on:
- mariadb
- redis
- phpmyadmin
secrets:
- mysql_password
- mysql_database
- mysql_user
- redis_host_password
volumes:
- ./nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
- MYSQL_DATABASE_FILE=/run/secrets/mysql_database
- MYSQL_USER_FILE=/run/secrets/mysql_user
- MYSQL_HOST=mariadb
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_HOST_PASSWORD_FILE=/run/secrets/redis_host_passowrd
- NEXTCLOUD_DATA_DIR=./private/data
#- NEXTCLOUD_TRUSTED_DOMAINS=asiliyamama.local
#- TRUSTED_PROXIES=172.18.0.0/16
- SMTP_HOST=
- SMTP_SECURE=
- SMTP_PORT=
- SMTP_AUTHTYPE=
- SMTP_NAME=
- SMTP_PASSWORD=
- MAIL_FROM_ADDRESS=
- MAIL_DOMAIN=
networks:
- test-aym
volumes:
nextcloud:
redis:
phpmyadmin:
networks:
test-aym:
external: true