Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

Part 1: Dockerising an Application and Standardising Compose

A practical guide to updating a Docker Compose file: use the Compose Specification, choose the preferred filename, define application services and resources, and check feature support before deployment.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To standardise a Docker Compose setup, use the Compose Specification in a file named compose.yaml, omit the obsolete top-level version selector, and define the application’s services and required resources explicitly. Keep image-building instructions in a Dockerfile when the application needs a custom image; Compose describes how its services run together.

Start with the application’s runtime needs

Before writing Compose configuration, list the processes required to run the application and what each one needs: an existing image or a Dockerfile build, environment settings, exposed ports, persistent data, network access, and startup dependencies. A typical web application might have a web service and a database service, but the right services depend on the application.

Compose uses a YAML file to configure services and related resources such as networks and volumes. The Compose CLI uses that configuration to create and start the described services. It does not replace a Dockerfile: when an application needs to be assembled into a custom image, the Dockerfile describes that build and the Compose service can refer to it.

Use the current Compose file format

Docker describes the Compose Specification as “the latest and recommended version of the Compose file format.” The legacy 2.x and 3.x formats were merged into the specification, which Docker Compose V2 implements. Start a new file with the current convention:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
services:
  web:
    build: .
    ports:
      - "8080:8080"

Save it as compose.yaml, Docker’s preferred default filename. compose.yml is also accepted. The older docker-compose.yaml and docker-compose.yml names remain supported for backward compatibility. If a canonical compose.yaml and a legacy-named file are both present, Compose prefers compose.yaml. See Docker’s Compose file reference and Compose documentation.

Leave out the top-level version field

Do not copy version: "3" into a new Compose V2 file. Compose V2 ignores the top-level field and interprets the configuration using the Compose Specification; it is not a control for selecting a modern schema. The field remains for backward compatibility, not as a required declaration. Docker explains this in its version and name reference.

Define each service for its actual role

A service describes a containerized component of the application. Choose either an image to run or a build context for an image that must be created, then add only the runtime settings that component needs. For example, a web process built from the current directory and a database using an existing image might look like this:

services:
  web:
    build: .
    ports:
      - "8080:8080"
    environment:
      DATABASE_HOST: db
    depends_on:
      - db

  db:
    image: postgres:16
    volumes:
      - db-data:/var/lib/postgresql/data

volumes:
  db-data:

This is an illustrative configuration, not a universal template: the image tag, port, environment variable names, and storage path must match the application and image in use. Add dependencies where startup ordering matters, but do not treat a dependency declaration by itself as proof that another service is ready to accept requests.

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

Use healthchecks with the image’s behavior in mind

A healthcheck can communicate whether a service is healthy, but its behavior and defaults follow the image’s Dockerfile HEALTHCHECK instruction. Check the image’s documented healthcheck and the Compose implementation’s behavior before assuming a particular check or dependency condition is portable. The Compose Specification includes optional features whose support can vary by implementation or target platform; consult Docker’s Compose file reference for the fields you intend to use.

Make networks and volumes explicit where needed

Networks and volumes are part of the Compose application model alongside services. A named volume, as in the example, gives the database a place for persistent data rather than relying on the container’s writable layer. Declare a network when the application needs a specific network arrangement; Compose can also provide its default network when none is declared.

Resource names are scoped to the Compose project. That scope matters when multiple deployments use the same configuration, because each project’s resources can be grouped separately.

Choose a project name for each deployment

A Compose project name groups and isolates the resources created from a configuration. Set a deliberate name when the same Compose file will run in parallel for different environments, branches, or users; distinct names let those deployments be distinguished without editing the file itself. Docker documents project naming in the version and name reference.

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.

If you do not set an explicit project name, Compose derives one from the project directory. That may be adequate for a single local instance, but an explicit name makes parallel deployments easier to identify and reduces accidental overlap caused by running the same project identity twice.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate against the Compose implementation you will use

The Compose Specification is the reference point, but not every specification area is mandatory or implemented identically everywhere. Build and deploy are optional parts of the specification, and support for advanced fields can depend on the selected Compose implementation and target platform. Docker Compose V2 implements the specification; for third-party implementations, check the relevant implementation’s documentation and version rather than assuming feature parity.

  1. Confirm the filename. Use compose.yaml for a new project and remove or account for legacy files that could create ambiguity.
  2. Check configuration with the Compose implementation and version used for deployment. Run docker compose config with Docker Compose V2 to parse and render the effective configuration; resolve reported syntax or interpolation problems before starting services.
  3. Review each field’s support. Confirm that optional features such as build or deploy settings are supported by the intended implementation and platform.
  4. Start and verify the application. Run docker compose up, then inspect service status and logs with docker compose ps and docker compose logs if a service fails to start or behave as expected.

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.

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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.