I am trying to deploy below stack in Portainer.io.
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- "80:80"
- "81:81"
- "443:443"
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "admin"
DB_MYSQL_PASSWORD: "adminpwd"
DB_MYSQL_NAME: "nginx"
volumes:
- '/mnt/nginx/data:/data'
- '/mnt/nginx/letsencrypt:/etc/letsencrypt'
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'adminpwd'
MYSQL_DATABASE: 'nginx'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: 'adminpwd'
volumes:
- '/mnt/nginx/data/mysql:/var/lib/mysql'
Issue:
But I am getting this below error,
Deployment error failed to deploy a stack: services.app.environment.volumes must be a string, number, boolean or null
Question:
I tried to change the format of volumes to different things but with no luck. What is wrong with this compose?
Volumes are at the environment variables indentation level, and it is of type list. So you need to indent the app volume as in db service and it should work.
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- "80:80"
- "81:81"
- "443:443"
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "admin"
DB_MYSQL_PASSWORD: "adminpwd"
DB_MYSQL_NAME: "nginx"
volumes:
- '/mnt/nginx/data:/data'
- '/mnt/nginx/letsencrypt:/etc/letsencrypt'
db:
image: 'jc21/mariadb-aria:latest'
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 'adminpwd'
MYSQL_DATABASE: 'nginx'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: 'adminpwd'
volumes:
- '/mnt/nginx/data/mysql:/var/lib/mysql'