Technical questionAccepted answer
docker-compose change name of main container
Michaelo
Jul 13
0 views1
I have a simple frontend and backend app. And I have a docker-compose file but it's inside frontend folder. So when I run it both frontend and backend containers are under frontend container (it takes name of the folder) how can I rename this main container? I am using version 3.9
version: "3.9"
services:
be_service:
container_name: backend
build:
context: ../backend
dockerfile: ./Dockerfile
ports:
- "8089:8080"
fe_service:
container_name: frontend
build:
context: ./
dockerfile: ./Dockerfile
ports:
- "8088:80"
depends_on:
- be_service
1 answer
Accepted answer · original discussion
Nguyen M. Ho
PermalinkJul 13
Related to Docker Compose docs you can set your project name with:
docker-compose -p app up --build
with -p app to set your compose container name to app.
2 question comments
Use comments to ask for clarification. Post a solution as an answer.
TigerwarePermalink
May 28
Does this answer your question? Set $PROJECT_NAME in docker-compose file