docker-compose.yml
version: '3.6'
services:
mysql:
image: mysql
secrets:
- login-password
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/login-password
secrets:
login-password:
external: true
部署
docker stack deploy -c=docker-compose.yml mysql-secret