Let's try docker compose

Rajesh GurajalaRajesh Gurajala
2 min read

In this article, we are going to explore the usage of docker compose with a practical web application which has react js as frontend, python fastapi as backend, postgresql as db and also this application is running deepseek llm 7b model locally. Each component ( fe, be, db, ai ) will run in its own container and backend container communicates with db and ai containers for seamless experience and responds to user requests which were sent from frontend container.

The website we are going to experiment is a prompt generation website which will first take input from user, and then generates dynamic questions related to user input for which user will answer related to his requirements. Finally, these answers will be again sent to AI to analyse and generate a effective prompt.

STEP 1: [Install Docker]

If ur os in windows or macos, install Docker desktop from

https://www.docker.com/products/docker-desktop/

which will download an installer exe file. Open it and follow instructions to complete installation.

Else if ur os is linux, just run these commands in ur terminal :

sudo apt update
sudo apt install docker.io -y
sudo usermod -aG docker ubuntu

a) ubuntu in 3rd command is username of host machine on which u install docker. To exactly determine the username of ur host, run whoami command.

b) Restart the host machine to apply changes.

STEP 2: [Cloning website repo from github]

Clone the website from the repo:

https://github.com/rajesh784203/prompt-generation.git

STEP 3: [Let’s run the website with juz 1 command]

In terminal, navigate to prompt-generation directory, and run docker compose up command.

The whole frontend, backend, db and ai model starts running and u can check in browser at localhost:5173

10
Subscribe to my newsletter

Read articles from Rajesh Gurajala directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rajesh Gurajala
Rajesh Gurajala