CSCI 338: Fall 2025

Software Engineering

CSCI 338: Fall 2025

Project 2 > Working with Your Containers

When working with Docker containers, it can be confusing to know whether you should run a command on your host computer (your laptop) or inside a Docker container. This guide will help clarify when to use each.

Your Host Computer

Run commands on your host computer when:

I recommend navigating to project02-fall2025 on your terminal and typing code . to edit your code files on your laptop (host machine).

Your Containers

Run commands inside containers when:

Why this matters:

1. Always install new packages on the correct container:

Frontend (Node.js packages):

# Install a new npm package (e.g., antd)
docker exec -it todo_frontend npm install antd

# Or if you've updated package.json, reinstall all dependencies
docker exec -it todo_frontend npm install

Backend (Python packages):

# Add a new package to pyproject.toml first, then install
docker exec -it todo_backend poetry add package-name

# Or if you've updated pyproject.toml, reinstall all dependencies
docker exec -it todo_backend poetry install

2. Always run the linters on the correct container:

Frontend (ESLint and Prettier):

# Check for linting and formatting issues
docker exec -it todo_frontend npm run check

# Automatically fix linting and formatting issues
docker exec -it todo_frontend npm run fix

Backend (Black, isort, flake8):

# Run all checks (doesn't modify files)
docker exec -it todo_backend bash scripts/check.sh

# Automatically fix formatting issues
docker exec -it todo_backend bash scripts/fix.sh

3. Query your database

Connect to PostgreSQL:

# Connect to the database container
docker exec -it todo_db psql -U postgres -d todo_db

# Once connected, you can run SQL queries:
# SELECT * FROM todos;
# \dt  (list all tables)
# \q   (quit)

Run a single SQL query without entering interactive mode:

docker exec -it todo_db psql -U postgres -d todo_db -c "SELECT * FROM todos;"

← Back to Project 2 Instructions