DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk9 min

Docker Compose Up Options and Arguments Explained

A practical reference to docker compose up options: when to build, recreate, wait for health, propagate exit codes, attach logs, renew volumes and remove orphan containers.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

docker compose up creates and starts the services defined in your Compose file. It can build images first, attach your terminal to service logs, run everything in the background, wait for services to become healthy, propagate a test container’s exit code, and clean up containers left behind by older configurations. The right option depends on whether you are developing interactively, deploying a changed image, running CI tests, or recovering from stale containers and volumes.

What docker compose up does

Compose reads the project configuration (normally compose.yaml, compose.yml, or a file supplied with a global -f option), then reconciles the declared services with containers on the host. It creates missing containers and starts them. If a service image must be built, you can request a build with --build. Without detached mode, Compose attaches your terminal to the services’ output so you can see logs as they start.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The command is usually written as docker compose up [OPTIONS] [SERVICE...]. Naming services at the end limits the operation to those services and the dependencies Compose needs to run them. Omitting service names brings up the whole application described by the file.

Foreground mode versus detached mode

Attached (foreground) mode

Running docker compose up keeps the command attached to container output. This is useful when starting a local stack and watching database migrations, web-server startup, or application errors. Pressing Ctrl+C stops the attached Compose session and normally stops the containers according to Compose’s shutdown handling.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Background mode with -d

-d or --detach starts the containers in the background and returns control of the shell. Use it for a development stack you want to leave running or for a host where another process manages the terminal session:

docker compose up -d

You can inspect output later with docker compose logs -f and stop the project with docker compose down. Detached mode cannot be combined with either --abort-on-container-exit or --abort-on-container-failure, because those modes require Compose to monitor container termination.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build and recreate controls

--build: build images before startup

--build tells Compose to build images before starting containers. It is the option to use after changing a Dockerfile or build context when you want the new image available immediately:

docker compose up --build

Building an image does not by itself mean every existing container will be replaced. Whether a container is recreated is decided by Compose’s configuration and image-change detection, or by an explicit recreate option.

--force-recreate: replace every container

--force-recreate stops and recreates every container, even when Compose detects no configuration change. Combine it with --build when you need both a fresh image and fresh containers:

docker compose up --build --force-recreate

This is useful after changing environment variables, mounts, network settings, or other container-level configuration and you want to eliminate any doubt that an old container is still being used.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

--no-recreate: keep existing containers

--no-recreate prevents Compose from recreating containers, including when configuration or image changes would normally trigger replacement. It is useful when preserving a running container is more important than applying the latest file changes. It is incompatible with --always-recreate-deps; those instructions conflict because one suppresses recreation while the other requests it for dependencies.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

--always-recreate-deps: refresh dependencies

--always-recreate-deps causes dependent containers to be recreated when the selected service is recreated. Use it when an application container must be tested against freshly created dependency containers rather than reusing the existing database, cache, or queue containers.

-V or --renew-anon-volumes: renew anonymous volumes

This option recreates anonymous volumes instead of reusing the anonymous volumes attached to existing containers. A common use is a rebuild where an anonymous volume still contains stale dependency or application data. Because renewing a volume discards the old anonymous-volume contents, do not use it when those contents are the only copy of data you need.

Waiting for startup and health

--wait

--wait makes Compose block until services are running or have reached their configured health state. It implies detached mode, so the command returns after the readiness condition is met rather than attaching to ongoing logs. A service without a health check can generally only be considered running; a health check gives Compose a stronger signal that the service is ready.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
docker compose up --wait

--wait-timeout SECONDS

--wait-timeout sets the maximum number of seconds Compose should wait for the running or healthy condition. The documented default is 0. In automation, set an explicit finite timeout so a failed health check cannot leave a job waiting indefinitely:

docker compose up --wait --wait-timeout 120

The timeout is a ceiling for the readiness wait; it does not change the health-check command or make an unhealthy service healthy.

Stopping a stack when a container exits

--abort-on-container-exit

This option stops all containers when any one container stops. It is useful for short-lived workflows such as integration tests, migration jobs, or a one-shot worker alongside its dependencies. It cannot be used with -d.

docker compose up --abort-on-container-exit

--abort-on-container-failure

--abort-on-container-failure is narrower: Compose stops the other containers when one exits with a failure. It also cannot be combined with detached mode. Choose it when successful one-shot containers are allowed to finish without stopping the rest, but a failing container should tear down the run.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

--exit-code-from SERVICE

--exit-code-from SERVICE makes the Compose command return the exit code from the named service’s container. It implies --abort-on-container-exit, so the rest of the project is stopped when that service exits. This pattern is valuable for test runners:

docker compose up --exit-code-from tests

The service name must match a service in the Compose file. Since this mode is attached and monitors termination, do not add -d.

Cleaning up containers from removed services

When a service is deleted or renamed in the Compose file, its old container is not automatically removed by every subsequent up. --remove-orphans tells Compose to remove containers for services that are no longer defined in the current file:

docker compose up -d --remove-orphans

Use this after reorganizing a Compose project, especially when an old service name is still visible in docker compose ps. The option removes orphan containers; it is not a general volume-cleaning command.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Log attachment options

--attach SERVICE

--attach SERVICE limits the output attached to your terminal to the named service. This keeps a noisy multi-container project readable while you watch one component:

docker compose up --attach api

--attach-dependencies

--attach-dependencies also attaches to the logs of dependencies of the selected services. It is useful when diagnosing an application that depends on a database or queue and you need both streams in one terminal. These two attach controls are incompatible with each other, so choose either a specific attachment selection or dependency attachment.

File-change development with --watch

-w or --watch enables Compose’s watch mode. Compose observes configured source files and rebuilds or refreshes containers when changes occur. The exact action depends on the watch rules in the Compose configuration; the flag alone does not define which paths are synchronized or rebuilt.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
docker compose up --watch

Watch mode is intended for a development loop. For a simple, predictable startup in scripts, use an explicit build, wait, or recreate option instead of assuming file watching is enabled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Shutdown timing with --timeout or -t

--timeout (short form -t) sets the shutdown timeout in seconds. The documented default is 0. It applies when Compose is attached or when containers are already running and Compose needs to stop them. A longer timeout gives applications more time to flush requests and close files; a shorter one makes teardown faster but increases the chance of forced termination.

docker compose up -t 30

Set this deliberately for services that need graceful shutdown, and confirm the behavior against the current Docker Compose reference for the version installed on your host.

Automatic confirmation with -y

-y or --yes answers yes to prompts. It can make unattended commands proceed without an interactive confirmation, but it also removes a safety pause. Use it only when the Compose file and the cleanup or recreation behavior have already been reviewed.

Common command combinations

Goal Command Why these options fit
Start a local stack and watch logs docker compose up Foreground attachment shows startup and runtime output.
Leave services running in the background docker compose up -d Detached mode returns the shell immediately.
Build changed images and recreate containers docker compose up --build --force-recreate Builds first, then replaces every container.
Start only after readiness checks pass docker compose up --wait --wait-timeout 120 Waits for running or healthy status with a finite limit.
Run tests and return the test container’s status docker compose up --exit-code-from tests Propagates the selected service’s exit code and stops the run.
Remove containers for deleted services docker compose up -d --remove-orphans Cleans up containers no longer represented in the file.
Discard stale anonymous-volume contents docker compose up -V Renews anonymous volumes instead of reusing them.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choosing between build, recreate, and reuse

  • Use --build when the image itself may be outdated.
  • Add --force-recreate when every container must be replaced, even if Compose sees no change.
  • Use --no-recreate when preserving current containers is intentional.
  • Use --always-recreate-deps when dependencies must be refreshed with the selected service.
  • Use -V only when anonymous-volume data should not be reused.

These controls solve different layers of the problem: image construction, container identity, dependency lifecycle, and volume contents. Rebuilding an image does not guarantee a new container, and recreating a container does not imply that persistent named-volume data is erased.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Automation and CI guidance

For a CI job that starts services and then runs checks, combine a readiness wait with a finite timeout, and use an exit-code option when the test service is the authoritative result:

docker compose up --build --wait --wait-timeout 120docker compose up --exit-code-from tests

Those are separate patterns: the first is for bringing a stack to readiness; the second is for a foreground test run whose status should be returned to the calling shell. Do not combine detached mode with abort or exit-code options. In scripts that may encounter renamed services, add --remove-orphans when removing obsolete containers is part of the job’s intended cleanup.

Options that need version-specific verification

Docker Compose has had both the current v2 plugin and the older v1 Python command. Several flags commonly appear in older manuals or secondary guides but are not confirmed here for the current v2 reference.

--no-deps

A v1-era manual describes --no-deps as preventing linked services from starting. That description should not be assumed for every current v2 release. Check the reference shipped with your installed Compose version before putting it in a production script.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

--pull and --no-start

No verified behavior is established here for these flags in the current docker compose up command. Do not rely on them solely because a blog post or shell completion suggests they exist; run docker compose up --help on the target installation and consult Docker’s current command reference.

Exit status and interruption behavior

An older manual states that the command exits with status 1 on error and exits 0 when interrupted with SIGINT or SIGTERM after stopping containers. That statement comes from the v1-era command documentation and may not describe every v2 release or every combination of options. If your pipeline depends on exact signal or exit-code semantics, test the installed Compose version and use --exit-code-from for the service whose result should determine a test run.

Troubleshooting by symptom

The terminal is flooded with logs

Use -d for background operation, or use --attach SERVICE to follow only one service. If you need the selected service plus its dependencies, choose --attach-dependencies instead; the two attach options cannot be combined.

Changes are not visible after editing a Dockerfile

Run docker compose up --build. If an old container still appears to hold previous configuration, add --force-recreate. If the stale state is inside an anonymous volume, consider -V only after confirming that discarding that volume’s data is safe.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An obsolete container remains

Run docker compose up -d --remove-orphans from the same project and file set. Verify the container belongs to the project before removing it, because the option targets containers for services absent from the current Compose file.

A readiness script hangs

Use --wait-timeout with a finite value and inspect the service health-check definition and logs. A timeout limits how long Compose waits; it does not repair a failing health check.

A test job returns the wrong status

Run the stack in attached mode with --exit-code-from SERVICE, replacing SERVICE with the test runner’s service name. Do not add -d, and remember that this option implies stopping the other containers when the selected service exits.

Practical decision checklist

  • Need visible logs now? Use foreground up.
  • Need a background stack? Add -d.
  • Changed a Dockerfile or build context? Add --build.
  • Must replace every existing container? Add --force-recreate.
  • Must preserve existing containers? Use --no-recreate.
  • Need a known-ready stack in automation? Use --wait and an explicit --wait-timeout.
  • Running a one-shot test or job? Use an abort option or --exit-code-from, never with -d.
  • Removed services from the file? Add --remove-orphans.
  • Suspect stale anonymous-volume data? Use -V only after checking what will be discarded.
  • Considering an unfamiliar flag? Verify it with the current v2 help and reference before scripting it.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.