docker compose up: options and common flags - Rocketeers

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com) 

 On this page

 Knowledge
---------

docker compose up: options and common flags
===========================================

### [\#Development](https://rocketee.rs/index.php/development)

docker compose up reads your compose file and starts every service in it. The flags you reach for most are -d to run in the background and --build to rebuild images first.

 Published by [Mark van Eijk](https://rocketee.rs/index.php/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [Start your services](#content-start-your-services)
2. [Run in the background](#content-run-in-the-background)
3. [Rebuild images first](#content-rebuild-images-first)
4. [Start only some services](#content-start-only-some-services)
5. [Stopping again](#content-stopping-again)
6. [A note on the command name](#content-a-note-on-the-command-name)

[\#](#content-start-your-services "Permalink")Start your services
-----------------------------------------------------------------

Run from the directory containing your `compose.yaml` (or `docker-compose.yml`):

 ```
docker compose up

```

This creates and starts every service defined in the file, and streams their logs to your terminal. Press `Ctrl+C` to stop them.

[\#](#content-run-in-the-background "Permalink")Run in the background
---------------------------------------------------------------------

Most of the time you want the stack running detached, so your terminal is free:

 ```
docker compose up -d

```

Check what is running and follow the logs separately:

 ```
docker compose ps
docker compose logs -f

```

[\#](#content-rebuild-images-first "Permalink")Rebuild images first
-------------------------------------------------------------------

If you changed a `Dockerfile` or the build context, force a rebuild before starting:

 ```
docker compose up -d --build

```

To throw away cached containers and recreate them from scratch:

 ```
docker compose up -d --force-recreate

```

[\#](#content-start-only-some-services "Permalink")Start only some services
---------------------------------------------------------------------------

Pass service names to start a subset. Add `--no-deps` if you do not want its linked services started too:

 ```
docker compose up -d web
docker compose up -d --no-deps web

```

[\#](#content-stopping-again "Permalink")Stopping again
-------------------------------------------------------

`Ctrl+C` stops a foreground `up`. For a detached stack, bring it down explicitly. `down` also removes the containers and network; `stop` just halts them:

 ```
docker compose down       # stop and remove containers + network
docker compose stop       # stop but keep the containers

```

[\#](#content-a-note-on-the-command-name "Permalink")A note on the command name
-------------------------------------------------------------------------------

Modern Docker uses `docker compose` (a built-in subcommand, Compose v2). The older standalone tool was `docker-compose` with a hyphen. If `docker compose` is not found, you are likely on an old install, upgrade Docker, or fall back to `docker-compose`.

Once it is up, [docker exec](/docker-exec) lets you run commands inside a running service, and [docker prune](/docker-prune) cleans up afterwards.

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#Development](https://rocketee.rs/index.php/development)

- [Install PHP memcached extension on macOS](https://rocketee.rs/index.php/install-php-memcached-extension-on-macos)
- [How to delete a local (and remote) Git branch](https://rocketee.rs/index.php/git-delete-local-branch)
- [Fix: Cannot connect to the Docker daemon at unix:///var/run/docker.sock](https://rocketee.rs/index.php/cannot-connect-to-docker-daemon)
- [git stash pop vs apply: save and restore changes](https://rocketee.rs/index.php/git-stash-pop)
- [How to clean up Docker with prune (images, volumes, system)](https://rocketee.rs/index.php/docker-prune)
- [What port does SSH use (and how to change it)](https://rocketee.rs/index.php/ssh-port)

 [View all 12 articles →](https://rocketee.rs/index.php/development)
