After docker-compose up -d or docker compose up -d error bufio.Scanner: token too long

Previously, I could run this docker-compose.yaml normally. After running docker-compose down, when I tried to start it again using dokcer-compose up -d , the error began.
cat docker-compose.yaml

version: "3"

services:
  web:
    build:
      context: calculator-emisi
    image: web-calculator-emisi
    restart: unless-stopped
    ports:
      - 8181:80
      - 8443:443
    volumes:
      - ./calculator-emisi:/var/www/html
    networks:
      - calculatoremisi-network

  calculatoremisi-db:
    image: postgres:14-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_PASSWORD=password
      # - POSTGRES_USER=user
      - POSTGRES_DB=DbDb

    ports:
      - 15432:5432
    volumes:
      - ./volume_db:/var/lib/postgresql/data
    networks:
      - calculatoremisi-network
networks:Q
  calculatoremisi-network:
    driver: bridge

this is the error

dev:~/calculator-docker$ docker-compose up -d
Creating network "calculator-docker_calculatoremisi-network" with driver "bridge"
Creating calculator-docker_calculatoremisi-db_1 ...
Creating calculator-docker_web_1                ... error
Creating calculator-docker_calculatoremisi-db_1 ... error
ERROR: for calculator-docker_web_1  Cannot start service web: bufio.Scanner: token too long

ERROR: for calculator-docker_calculatoremisi-db_1  Cannot start service calculatoremisi-db: bufio.Scanner: token too long

ERROR: for web  Cannot start service web: bufio.Scanner: token too long

ERROR: for calculatoremisi-db  Cannot start service calculatoremisi-db: bufio.Scanner: token too long
ERROR: Encountered errors while bringing up the project.

my journalctl -u docker.service -f said

dockerd[1383]: time="2026-02-22T18:39:53.242878615Z" level=error msg="Handler for POST /v1.45/containers/8705b4a0e2f678394cbae8e3ec125b1ee1e9e22121245459451996be8d9aacf0/start returned error: bufio.Scanner: token too long" spanID=a760fe62cac1936e traceID=37aeec1c13fed0d2c0a38ec2e7be2e04

my sudo tail -f /var/log/syslog said

dockerd[1383]: time="2026-02-22T19:07:55.994520045Z" level=error msg="Handler for POST /v1.45/containers/8705b4a0e2f678394cbae8e3ec125b1ee1e9e22121245459451996be8d9aacf0/start returned error: bufio.Scanner: token too long" spanID=06deda846cf04bee traceID=85fd502a088d5c8c2d8ccb4332331f08

run simple hello-world is error

docker run hello-world
docker: Error response from daemon: bufio.Scanner: token too long.

my os is ubuntu with docker version 28 still issue, i try docker version 27 and still issue, i try docker 26 and still issue

please help

Please share the output of docker-compose version.

Try if using docker compose up -d solves the issue.

The output of docker info and docker version could be even more important if you really get the same bufio error for a simple docker run hello-world command. Remove any private details from the output befoe sharing if you find any.

But please, when you share any output, don’t forget to use code blocks, so I don’t need to edit your post to add it and make your message readable. You can use the common MArkDown syntax ot just the </> button to open a new code block.

docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.12
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022

docker version
Client:
Version: 26.0.0
API version: 1.45
Go version: go1.21.8
Git commit: 2ae903e
Built: Wed Mar 20 15:16:45 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 26.0.0
API version: 1.45 (minimum version 1.24)
Go version: go1.21.8
Git commit: 8b79278
Built: Wed Mar 20 15:18:14 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.13
GitCommit: 7c3aca7a610df76212171d200ca3811ff6096eb8
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0

here is my docker info
docker info
Client:
Version: 26.0.0
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.15.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.27.0
Path: /usr/libexec/docker/cli-plugins/docker-compose

Server:
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 1
Server Version: 26.0.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 7c3aca7a610df76212171d200ca3811ff6096eb8
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.0-170-generic
Operating System: Ubuntu 22.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 3
Total Memory: 14.63GiB
Name: pirsa-dev
ID: d4698b72-ccfa-4f4b-8939-23e47b694734
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

Thank you for helping us making the forum more readable to anyone..

yes sir, please help

here is my docke-compose version.

docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.3
CPython version: 3.10.12
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022

Make sure to use docker compose (Docker plugin, without dash, doc) and not the legacy docker-compose.

still error using docker compose up -d

Maybe we start with the usual. Your Docker release 26.0.0 is from 2024-03-20, maybe it’s time to upgrade.

I found a closed issue i the Moby (Docker upstream repo) Github repo: Cannot run any containers: bufio.Scanner: token too long Ā· Issue #51679 Ā· moby/moby Ā· GitHub

Maybe your /etc/reoslv.conf is too long as well?

2 Likes

my docker version before is 28 until i decide to downgrade with 26 version

Thank you, sir. Your references helped me a lot. I ran ls -lh /etc/resolv.conf to check the file size (it was 94 KB; according to Google, the limit is 64 KB). As a temporary solution, I truncated /etc/resolv.conf

Glad you found the culprit!

I am surprised your resolv.conf is this big. Even 64kb sounds ridiculous larg.e I would expect something along the lines of <2kb… You might want to investigate what caused it.