Conduit Container
A Docker-based setup to run an Angular frontend and a Django backend together in a unified, containerized environment. This project demonstrates how to package, network, and secure multiple services using Docker and Docker Compose for local development and cloud-ready deployment.
The main goal of this project is to consolidate knowledge in containerization, networking, and basic network security by operating a full-stack application stack in isolated yet connected containers.
TOC
URL: https://github.com/hpetersen2/conduit-container
Checkout this repository to see the code/implementation
Installation / Quickstart
Follow these steps to get the project up and running locally.
Prerequisites
- Docker Desktop (Docker Engine + Docker Compose)
- Git
If Docker is not installed, follow the official installation guide:
- Docker Desktop (Windows / macOS): https://docs.docker.com/desktop/
- Docker Engine (Linux): https://docs.docker.com/engine/install/
After installation, verify Docker:
docker --version
docker compose --version
Setup Steps
-
Clone the project repository:
git clone git@github.com:HPetersen2/conduit-container.gitcd conduit-container -
Initialize and update Git submodules (frontend & backend):
git submodule update --init --recursive -
Copy the environment template file and adjust the values (ports, secrets):
cp .env.template .env -
Make sure Docker Desktop is installed and running.
-
Build and start all services:
docker compose up --build -d -
To stop and remove the containers:
docker compose down
Usage
After starting the stack with Docker Compose, the containers run together within a shared Docker network. The Angular frontend consumes the backend via the service name defined in docker-compose.yml. All configuration (ports, hostnames, secrets) is controlled via the .env file.
Starting and Stopping Services
Start the stack in detached mode:
docker compose up -d
Start the stack with build (useful after code changes):
docker compose up --build -d
Stop and remove containers (volumes and database data are preserved):
docker compose down
Stop and remove containers and volumes (deletes the database data):
docker compose down --volumes
Creating a Django Superuser
To access the Django admin interface, you need to create a superuser account:
docker compose exec backend python manage.py createsuperuser
Follow the prompts to set a username, email, and password. After creation, you can log in to the Django admin panel.
Accessing Services
Once the containers are running, the services are available at:
- Frontend (Angular):
http://localhost:4200 - Backend (Django API):
http://localhost:8000 - Django Admin Panel:
http://localhost:8000/admin
Make sure the ports match those defined in your .env file.
Database Management
Run Django migrations to set up or update the database schema:
docker compose exec backend python manage.py migrate
Create new migrations after model changes:
docker compose exec backend python manage.py makemigrations
Access the database shell:
docker compose exec backend python manage.py dbshell
Viewing Logs
View logs from all services:
docker compose logs -f
View logs from a specific service (e.g., backend):
docker compose logs -f backend
View logs from the frontend:
docker compose logs -f frontend
Running Django Management Commands
Execute any Django management command inside the backend container:
docker compose exec backend python manage.py <command>
Examples:
# Check for issues
docker compose exec backend python manage.py check
# Collect static files
docker compose exec backend python manage.py collectstatic --no-input
# Create a new Django app
docker compose exec backend python manage.py startapp myapp
# Load fixture data
docker compose exec backend python manage.py loaddata fixtures/initial_data.json
Rebuilding Containers
If you've made changes to Dockerfiles or dependencies, rebuild the containers:
docker compose build
Rebuild a specific service:
docker compose build backend
Rebuild without cache (clean build):
docker compose build --no-cache
Updating Submodules
If the Git submodules (frontend or backend) need to be updated, run the following command:
git pull --recurse-submodules
git submodule update --init --recursive
Architecture Overview
- Angular Frontend: Built and served from a dedicated frontend container
- Django Backend: Runs in its own container with isolated dependencies
- Docker Network: Enables secure communication between services
- Environment Variables: Centralized configuration via
.envfile
This setup mirrors real-world cloud deployments and encourages best practices in service isolation and network security.
Contributing
Contributions are welcome.
- Fork the repository
- Create a new feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add new feature') - Push the branch (
git push origin feature/your-feature) - Open a Pull Request
License
This project is licensed under the MIT License. See the LICENSE file for details.