docker/cli ยท error

tty service logs only supported with --raw

Error message

tty service logs only supported with --raw

What it means

Raised by `docker service logs <task>` when the target task's container was created with TTY enabled (tty: true) and --raw was not passed. TTY output multiplexes stdout/stderr into a single raw stream with terminal control sequences, which the CLI's pretty log formatter (task-name prefixes, timestamps) cannot demultiplex, so it requires --raw.

Source

Thrown at cli/command/service/logs.go:106

		res, err := apiClient.TaskInspect(ctx, opts.target, client.TaskInspectOptions{})
		if err != nil {
			if errdefs.IsNotFound(err) {
				// if the task isn't found, rewrite the error to be clear
				// that we looked for services AND tasks and found none
				err = fmt.Errorf("no such task or service: %v", opts.target)
			}
			return err
		}

		tty = res.Task.Spec.ContainerSpec.TTY
		maxLength = getMaxLength(res.Task.Slot)

		// we can't prettify tty logs. tell the user that this is the case.
		// this is why we assign the logs function to a variable and delay calling
		// it. we want to check this before we make the call and checking twice in
		// each branch is even sloppier than this CLI disaster already is
		if tty && !opts.raw {
			return errors.New("tty service logs only supported with --raw")
		}

		// now get the logs
		responseBody, err = apiClient.TaskLogs(ctx, opts.target, client.TaskLogsOptions{
			ShowStdout: true,
			ShowStderr: true,
			Since:      opts.since,
			Timestamps: opts.timestamps,
			Follow:     opts.follow,
			Tail:       opts.tail,
			// get the details if we request it OR if we're not doing raw mode
			// (we need them for the context to pretty print)
			Details: opts.details || !opts.raw,
		})
		if err != nil {
			return err
		}
		defer responseBody.Close()

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Add --raw: `docker service logs --raw <task>`.
  2. If TTY isn't actually needed, remove it: `docker service update --tty=false <service>` or drop `tty: true` from the stack file, then redeploy.
  3. Use `docker logs <container>` on the node running the task as an alternative.

Example fix

# before
docker service logs my-svc.1.abc123
# after
docker service logs --raw my-svc.1.abc123

When it happens

Trigger: `docker service logs <task-id>` where the task belongs to a service created with `--tty`/`tty: true` in the compose/stack file; this branch fires when the target resolved to a task rather than a service.

Common situations: Services given tty: true in a stack file for interactive debugging or because an image/docs suggested it, then operators later trying to read logs of an individual task; older CLI versions couldn't show these logs at all.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/0d1d10a006c48c4c.json. Report an issue: GitHub.