How to Run Docker Compose in Docker Desktop

To run Docker Compose in Docker Desktop, start Docker Desktop, open a terminal in your project folder, and start the services defined in your Compose file. You do not need to import the file into the dashboard first. This guide covers running an existing project or a small working example, finding it in Docker Desktop, and managing logs, ports, and cleanup.

How Docker Compose Works With Docker Desktop

Starting an application with Compose and managing it in Docker Desktop are parts of the same workflow, not separate deployments.

Compose reads a YAML configuration file that defines your application’s services, networks, and volumes. Docker Desktop supplies the local engine that runs those containers and a dashboard for inspecting them.

Docker Desktop includes Docker Compose, Docker Engine, and the Docker CLI, according to Docker’s installation documentation. If Desktop is installed, use its bundled Compose rather than installing a separate plugin.

Run Compose commands in a terminal on your computer, not in a container’s Exec tab. PowerShell, Windows Terminal, macOS Terminal, a Linux terminal, or an editor’s integrated terminal will work, provided it can access Docker Desktop.

Compose groups the resulting containers into a project. Unless overridden, the project name comes from the project directory’s name; that is usually the name you will look for in Docker Desktop.

How to Run a Compose Project in Docker Desktop

Docker Desktop can validate, start, and display a Compose project from its project directory using the Compose command and Containers view.

Step 1: Start Docker Desktop and Check the Connection

  1. Open Docker Desktop and wait until its engine is running.
  2. Open Docker Menu > About Docker Desktop to check the bundled Compose version.
  3. Open a terminal and verify that the Compose command is available:
    docker compose version
  4. Check that the CLI can reach a running Docker engine:
    docker info

Successful output includes server information. If you receive a connection error, resolve it before proceeding: Desktop may still be starting, its engine may be stopped, or your terminal may be targeting another Docker environment.

On Windows, the example below requires Docker Desktop to be running Linux containers.

Step 2: Open Your Project and Prepare the Compose File

Choose the starting point that matches your project.

Your Starting Point What to Use
The project already has a Compose file Keep its configuration and use the project’s setup instructions for any required environment files or credentials.
You want a working example Create a project folder and use the minimal configuration below.
The project only has a Dockerfile Create a Compose file with a service using build: ., plus the application’s required ports and environment settings.
  1. Open your terminal in the project directory. For the example, create and enter a new folder:
    mkdir compose-desktop-demo
    cd compose-desktop-demo
  2. In a text editor, save the following as compose.yaml inside that folder:
    services:
      web:
        image: docker/welcome-to-docker
        ports:
          - "127.0.0.1:8080:80"

    This defines a service named web using Docker’s welcome image. Host port 8080 connects to the container’s web server on port 80; the 127.0.0.1 binding limits access to your own computer.

  3. Confirm that the editor saved a YAML file, not a file ending in .yaml.txt.

No Dockerfile is needed for this image-only example. An existing project may instead use build to create an image from its source code.

Current Compose also recognizes older filenames such as docker-compose.yml. You do not need to rename an existing project’s file merely to run it. For new files, omit the top-level version field: modern Compose uses the Compose Specification, and that field is obsolete.

Step 3: Validate the Configuration and Start the Services

  1. Validate the file before creating containers:
    docker compose config

    This parses the YAML, resolves Compose configuration, and displays the effective configuration. It does not require the application to be running. Fix any reported YAML or missing-variable errors first. If the project supplies an example environment file, populate the required settings before continuing. Avoid sharing the resolved output publicly if it contains credentials.

  2. Build and start the services in the background using the workflow in Docker’s application tutorial:
    docker compose up --build --detach

    --build builds services that have a build configuration. --detach leaves the containers running after the command returns. For the welcome example, Compose downloads the image if needed and creates the container and project network. It has no local image to build.

  3. Inspect the services:
    docker compose ps

    Check the service status and published ports. A successful startup command means the containers were created or started; it does not necessarily mean the application inside them is ready to accept requests.

Step 4: Find the Project in Docker Desktop and Open It

  1. Open Docker Desktop and select Containers.
  2. Find the project group, normally named after your project folder.
  3. Expand it to see its service containers. Select a container to inspect its logs, state, and other details.
  4. For the welcome example, open http://localhost:8080 in your browser. The Docker welcome page confirms that the container and port mapping are working.

Your application’s browser address comes from its published host port, not necessarily the port used inside the container.

Docker’s Flask Compose Quickstart uses host port 8000 mapped to container port 5000, so that application opens at http://localhost:8000. Those are Quickstart-specific values, not universal Compose defaults. Use the host port specified in the ports entry of your project’s compose.yaml for the browser address.

You can now use Docker Desktop to inspect or stop the containers. Keep the YAML file as the place where you change service definitions.

Windows 11 and Other Compose Workflows

On Windows 11, Compose can run from PowerShell or an integrated WSL 2 distribution, with custom files, Watch, and one-off containers.

Running Compose From WSL on Windows 11

PowerShell can use Docker Desktop directly. If you prefer to run commands inside a WSL distribution, that distribution needs access to Desktop’s engine.

  1. Ensure the distribution uses WSL 2.
  2. In Docker Desktop, enable Settings > General > Use the WSL 2 Based Engine.
  3. Open Settings > Resources > WSL Integration and enable integration for your distribution.
  4. Apply the changes and reopen the WSL terminal.
  5. Verify the connection:
    docker info

Run docker info in the WSL terminal. Server information in the output confirms that the distribution can reach the engine. You do not need to install a second Docker Engine inside that distribution for this workflow.

If Docker Desktop is in Windows-container mode, switch to Linux containers from the Docker menu before running Linux images such as the welcome example.

Running a File With a Custom Name

For a file outside Compose’s normal filename discovery, select it with the global -f option. For example, if your file is named stack.yml, run:

docker compose -f stack.yml up --build --detach

Then check that project’s services:

docker compose -f stack.yml ps

Open the application at its published host port and confirm that it responds. Continue supplying the same file option when viewing logs, stopping services, or removing this project.

Starting Compose Watch for Live Updates

Compose Watch is for projects configured with develop.watch rules. It can synchronize changed files, rebuild images, or perform other configured actions while you develop.

From a project with those rules configured, start it with:

docker compose up --watch

Edit a file covered by a watch rule, check the terminal for the configured action, and refresh the application to confirm the change. Watch does not automatically know which files to synchronize; those rules must exist in the project configuration.

This command runs in the foreground. Pressing Ctrl+C stops the attached session and its containers.

Publishing Ports for a One-Off Container

The Compose run subcommand creates a one-off container for a service. Unlike the normal startup workflow, it does not publish that service’s configured ports by default.

If a temporary container needs those ports, add --service-ports:

docker compose run --rm --service-ports web

This starts the web service’s default command in a temporary container. Use it only when the configured host ports are free; if the regular web container is already using them, stop that container in Docker Desktop first.

For a foreground web process, open its published address to test it, then press Ctrl+C when finished. The --rm option removes the temporary container when it exits. For normal application startup, run docker compose up –build –detach from the project directory.

How to Stop and Remove a Compose Project

Run lifecycle commands from the project directory, retaining any custom file or project-name options you used to start it.

Stopping Without Removing Containers

To stop the services while keeping their containers:

docker compose stop

The containers remain available in Docker Desktop in a stopped state. To resume them:

docker compose start

This is useful when you want to pause work without removing the project. It starts existing containers; it does not rebuild images or apply new service definitions.

Removing Containers and Networks

To stop and remove the project’s containers and its Compose-created networks:

docker compose down

Declared named volumes remain by default. However, files stored only in a container’s writable layer disappear when that container is removed.

For data that must survive container replacement, use an appropriate named volume or bind mount rather than relying on the container filesystem.

Deleting the Project’s Volumes

For a deliberate cleanup that also removes the project’s non-external named volumes and attached anonymous volumes:

docker compose down --volumes

This can permanently delete application data, including local databases. Back up anything you need before running it.

Once cleanup completes, the removed containers no longer appear in Docker Desktop.

Fix Common Docker Compose Startup Problems

Match the error to the failed part of the workflow before reinstalling anything.

Symptom Likely Cause First Fix
Docker cannot connect to the daemon Desktop is stopped, the engine is unavailable, or the CLI targets another engine Start Desktop and check the Docker connection and active context.
“No configuration file provided” The terminal is in the wrong directory, or the file has an unrecognized name Open the project folder or select the file with -f.
Docker does not recognize the Compose subcommand The shell is using an old or incomplete Docker CLI installation Reopen the terminal; check which Docker installation it uses, then update or repair Desktop if necessary.
“Port is already allocated” or “address already in use” Another process or container owns the host port Stop the conflicting process or change the host side of the port mapping.
A service exits immediately The application’s startup command or configuration failed Inspect that service’s logs and correct the reported error.
A container runs but the browser cannot connect The host port is missing or wrong, or the application is not listening correctly Check published ports, application logs, and the address the application binds to inside the container.

Finding the Application Error

Inspect recent output from the service that failed. For a service named web:

docker compose logs web

Replace the service name when your project uses a different one. Look for a concrete startup error: a missing environment variable, inaccessible file, failed database connection, or invalid application command.

If the container exited and does not appear in the default status view, include stopped containers:

docker compose ps --all

Correct the reported configuration or application problem before recreating the service.

Finding the Engine Behind a Missing Desktop Project

If Compose succeeds but the project is absent from Docker Desktop, check which Docker context the terminal uses:

docker context ls

The active context is marked with an asterisk. A remote engine or a separately installed local engine will not show its containers in Desktop’s local engine view.

For Desktop’s Linux engine, if desktop-linux appears in the list, select it:

docker context use desktop-linux

Also check whether your shell has a DOCKER_HOST or DOCKER_CONTEXT override pointing elsewhere. Remove an unintended override before retrying.

Retrying After the Fix

After correcting the cause, start the project again:

docker compose up --build --detach

Then verify its status:

docker compose ps

Open the application at its configured host port. If you changed a port mapping, use the new host port in the browser, not the old address.

Confirm Your Compose Project Is Working

A running container is only part of the check. Confirm that:

  • Docker Desktop shows the expected project and service containers.
  • Required services stay running rather than repeatedly restarting.
  • Services with configured health checks become healthy.
  • The application responds at its published host address.
  • Logs do not show repeated startup, connection, or configuration failures.

To follow the project’s logs while testing:

docker compose logs --follow

Press Ctrl+C to stop following logs; the containers keep running.

When you change service configuration, recreate the affected containers through Compose rather than relying on a dashboard restart to apply the edits. Keep the Compose file with the project, keep credentials out of version control, and confirm that important application data lives in persistent storage.

Once the application responds correctly, use Docker Desktop for inspection and the project configuration for repeatable changes.

Frequently Asked Questions

Is Docker Compose Obsolete?

No. Docker Compose is actively supported and included with Docker Desktop. The old standalone Compose V1 implementation is obsolete; use the modern Compose subcommand of the Docker CLI rather than installing that legacy tool.

What Is the Difference Between Docker Run and Docker Compose?

Docker’s run command creates a container from an image using options supplied on the command line. Compose stores service configuration in YAML and manages the application’s containers, networks, and volumes together. Compose is especially useful for multi-service applications, but it also makes a single-container setup repeatable.

Can I Run Docker Compose Without Docker Desktop?

Yes. On Linux, you can install Docker Engine, the Docker CLI, and the Compose plugin without installing Desktop. Compose still needs access to a compatible running engine; installing the Compose plugin alone does not provide one.