Docker Community Forums

Share and learn in the Docker community.

[newbie] build a simple django react postgres docker container?

OS Version/build: WSL2 Ubuntu 20.04
App version: Docker desktop windows

So I’m a newbie with Docker, I learned the very very basics from my lessons and took the getting started tutorial, I managed to build a container containing 2 docker images or I don’t know the terminology yet i’m a bit confused, one for Django and another one for postgres, tried to reach localhost 8000 and it worked, now I would like to make a third container inside of the main for my react-app, how can I do that ?

my Dockerfile:

FROM python:3
COPY .  /usr/src/app
WORKDIR /usr/src/app
RUN pip install -r requirements.txt
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

my docker-compose.yml:

version: '3.8'

services:
    db:

        image: postgres
        environment:
            - POSTGRES_DB=postgres
            - POSTGRES_USER=postgres
            - POSTGRES_PASSWORD=postgres

    web:
        build: .
        volumes:
            - .:/usr/src/app
        ports:
            - "8000:8000"

So can anyone explain me the steps, what to add and why ? It would be much helpful as I didn’t understand much from the tutorial on internet