Docker containers in same network
(1 min read)In this project, we are testing two containers in same network. We have following apps:
Apps
- server - an Express app running on port 4444
- client - a NextJs app running on port 3000
Build containers
- Build client
docker build --build-arg NEXT_PUBLIC_BACKEND_URI=http://localhost:4444 -t client .
- Build server
docker build -t server .
- Create a network
docker network create test-common-net
Running containers in same network
- Run server
docker run -p 4444:4444 --net test-common-net --name server -d server
- Run client
docker run -p 3000:3000 --net test-common-net --name client -d client
Github Link: Docker containers in same network