[Bug]: COOLIFY_CONTAINER_NAME does not match any of container names
Description
Created containers:
Docker inspect for node service show this env:
"Env": [
// other
"COOLIFY_CONTAINER_NAME=lck0o48-061119181951",
// other
],
Docker inspect for mysql service:
"Env": [
// other
"COOLIFY_CONTAINER_NAME=lck0o48-061119181951",
// other
],
Shouldn’t all containers have the same identifier? That is, 061119181951 in this case.
Minimal Reproduction (if possible, example repository)
docker-compose file:
services:
staging-project-nginx:
image: nginx:alpine
container_name: staging-project-nginx
depends_on:
- staging-project-node
ports:
- '8001:80'
volumes:
- './:/var/app'
- './deploy/nginx/staging:/etc/nginx/conf.d/'
networks:
- staging-project-network
staging-project-node:
container_name: staging-project-node
depends_on:
- staging-project-mysql
build:
context: .
dockerfile: Dockerfile
restart: always
environment:
- NODE_ENV=production
ports:
- '${DEPLOYMENT_PROXY_PORT:-3201}:3000'
working_dir: /app
networks:
- staging-project-network
command: pnpm run prisma:migrate:deploy
staging-project-mysql:
image: mysql:8.4
container_name: staging-project-mysql
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
ports:
- '3306:3306'
volumes:
- 'staging-project-mysql:/var/lib/mysql'
networks:
- staging-project-network
networks:
staging-project-network:
name: staging-project-network
internal: true
driver: bridge
volumes:
staging-project-mysql:
driver: local
Part of my env file:
DB_DATABASE=databasename
DB_USERNAME=user
DB_PASSWORD=password
MYSQL_ROOT_PASSWORD=password
DB_HOST=staging-project-mysql-${COOLIFY_CONTAINER_NAME}
DATABASE_URL=mysql://root:${MYSQL_ROOT_PASSWORD}@${DB_HOST}:3306/${DB_DATABASE}
Exception or Error
Version
v4.0.0-beta.323
Cloud?
- [ ] Yes
- [X] No
they are in the same network so you can use the container name of staging-project-mysql
they are in the same network so you can use the container name of staging-project-mysql
That's what i'm trying to do. When coolify starts an app, it generates unique container names, so i can't use the names from the original docker-compose.
@fipnooone you can use the service name, this doesn't change
@fipnooone you can use the service name, this doesn't change
🤦 thank you. But i'll keep this issue open, since COOLIFY_CONTAINER_NAME doesn't work as it should. Or maybe am i wrong here too?
@fipnooone thats the container name of the app, not the database, jsut use staging-project-mysql
How did you solve this issue or Is it not solve yet? @fipnooone
Same problem here