This workflow assumes the project is running through Docker Compose and compose.yaml is the entry point for the stack.
Start the stack
Navigate to the project folder first. Docker Compose always reads the compose.yaml in the current directory, so running commands from the wrong location will either fail or affect the wrong project.
cd ~/your-projectStart in detached mode, reusing existing images if available:
docker compose up -d
# -d: detachForce a rebuild when Dockerfiles, dependencies, or package lockfiles have changed:
docker compose up -d --buildCheck status and service names
Use docker compose ps to check the process status of containers that belong to the Compose project in the current directory.
docker compose ps
# ps: process statusThe command is project scoped. It reads the Compose project from the current folder, usually compose.yaml, and shows only the containers managed by that Compose project.
Use docker compose config --services when you need the exact service names from the Compose file. These names are used with commands like exec, logs, restart, and stop.
docker compose config --servicesUse docker ps when you need a system level view of all running containers on the Docker host, including containers started by other Compose projects.
docker ps- docker compose ps shows containers for the current Compose project.
- docker ps shows all running containers globally on the Docker host.
- Multiple Compose projects can run at the same time.
- Host ports must be unique. For example, only one running container can bind host port 3306.
- Container ports can be the same across containers because each container has its own network namespace.
Enter a container
Enter a running service container to work inside its environment. Commands run here use the container's tools, paths, and installed packages.
docker compose exec <service-name> bashIf bash is not available in the container, use sh instead:
docker compose exec <service-name> shOnce inside, verify your location and check available files:
pwd
lsFollow logs
Stream live output from a service without entering. Can be used to follow server output or to debug startup issues.
docker compose logs -f <service-name>Stop the stack
Stop and remove containers and the compose network entirely:
docker compose downStop containers without removing them:
docker compose stopTypical daily sequence
cd ~/your-project
docker compose up -d
docker compose ps
docker compose exec backend bash
docker compose exec frontend bash- After a reboot, containers do not restart automatically unless restart policies are configured.
- docker compose exec requires the container to already be running.