I am using the next tools versions:
- Ubuntu version: 22.04.1
- Docker version: 23.0.0, build e92dd87
- Docker compose version: v2.16.0
- Portainer version: 2.17.0
I am trying to setup the stack from Git repository via Portainer by following the next instruction from official docs.
I am using 2 profiles: dev
and prod
so my docker docker-compose.yml
file looks like below:
version: '3.4'
services:
backend:
image: ${DOCKER_REGISTRY-}myproject
profiles: ["dev", "prod"]
db:
image: postgres:15.2-alpine3.17
profiles: ["dev", "prod"]
frontend:
image: ${DOCKER_REGISTRY-}myproject_frontend
profiles: ["dev", "prod"]
volumes:
db_data:
frontend_data:
logs:
When I tried to use my prod
profile in Portainer stack via COMPOSE_PROFILES
ENV variable as was proposed in this Portainer issue like COMPOSE_PROFILES=prod docker compose up
then I get the same error if I don't use any ENV variable at all. The error says:
Deployment error
failed to deploy a stack: no service selected
I tried to specify the path to the docker-compose.prod.yml
file in the Additional paths
field, but got the same error as above. If I try to use the path to docker-compose.prod.yml
in Compose path
then I got the the next error for every named volume:
service "frontend" refers to undefined volume "frontend_data"
I thought that something wrong in my docker-compose.prod.yml
file, but when I copied its content to docker-compose.yml
(and also deleted COMPOSE_PROFILES
ENV variable) then Stack was successfully created.
So my question about ability to use Docker compose profiles in Portainer Stacks. Is it impossible or am I doing something wrong?