FG
☁️ Cloud & DevOpsDocker

`docker-compose up` hangs when tty parameter is true

Freshabout 21 hours ago
Mar 14, 20260 views
Confidence Score86%
86%

Problem

Here's a minimal setup to reproduce the issue: Dockerfile content: [code block] docker-compose.yml content: [code block] Here's what happens when I try docker-compose up: [code block] My user is added to `docker` group, and the output is the same when run from `sudo`. It manages to attach only with `docker-compose run` command. I tried the experiment with same outcomes on `Docker version 1.9.1, build a34a1d5`, and compose versions `1.4.0`, `1.6.0`, and `1.6.2`. UPD: docker info output: [code block] `docker-compose --verpose up` output: [code block]

Error Output

ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix Docker Compose Hanging with TTY Parameter

Medium Risk

The issue arises when the TTY parameter is set to true in the docker-compose.yml file, which can cause the process to hang if the terminal is not properly attached or if there are issues with the Docker daemon connection. This is often exacerbated by the Docker daemon not being accessible or running correctly, leading to the error 'Couldn't connect to Docker daemon'.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Verify Docker Daemon Status

    Ensure that the Docker daemon is running correctly. You can check its status with the following command.

    bash
    sudo systemctl status docker
  2. 2

    Restart Docker Daemon

    If the Docker daemon is not running or is in a failed state, restart it to ensure it is operational.

    bash
    sudo systemctl restart docker
  3. 3

    Modify docker-compose.yml TTY Parameter

    If the issue persists, consider removing or setting the TTY parameter to false in your docker-compose.yml file to avoid hanging issues.

    yaml
    tty: false
  4. 4

    Test Docker Compose Command

    After making the changes, run the docker-compose up command again to check if the issue is resolved.

    bash
    docker-compose up
  5. 5

    Check Docker Compose Version

    Ensure you are using a compatible version of Docker Compose. Upgrade to a more recent version if necessary, as older versions may have unresolved bugs.

    bash
    sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '"' -f 4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose

Validation

To confirm the fix worked, run 'docker-compose up' and ensure that it completes without hanging. Additionally, check for any error messages related to the Docker daemon.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

dockerdocker-composecontainerskind/bug