eg3 removed unnecessary exposed port

This commit is contained in:
Jason Zhu 2023-05-05 00:06:20 +10:00
parent 7bdffc22cf
commit 7074e55f40
2 changed files with 4 additions and 6 deletions

View File

@ -22,7 +22,9 @@ In this section, we test frontend container can cross-communicate with backend c
Steps: Steps:
1. Comment out proxy container 1. Comment out proxy container
2. frontend has port 80 exposed; backend has port 5000 exposed; 2. Remove exposed of both containers, as we they don't need expose their ports to outside environment. We just want to test their cross-communication in the same docker network
1. port 80 for frontend;
2. port 5000 for backend;
3. Run `docker compose build` & `docker compose up` 3. Run `docker compose build` & `docker compose up`
4. Create a network: `docker network create mynetwork` 4. Create a network: `docker network create mynetwork`
5. Add containers into network 5. Add containers into network

View File

@ -17,13 +17,9 @@ services:
build: build:
context: ./frontend context: ./frontend
dockerfile: Dockerfile dockerfile: Dockerfile
ports:
- "80:80" # Uncomment this line if you want to run the frontend container only
backend: backend:
container_name: backend container_name: backend
build: build:
context: ./backend context: ./backend
dockerfile: Dockerfile dockerfile: Dockerfile
ports:
- "5000:5000" # Uncomment this line if you want to run the backend container only