Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'docker logs --tail 0 <container ID>' outputs all the logs instead of no log #35393

Closed
xiangfeiz opened this issue Nov 3, 2017 · 3 comments
Closed

Comments

@xiangfeiz
Copy link

Description

'docker logs --tail 0 ' outputs all the logs instead of no log

Steps to reproduce the issue:

  1. start a container which generates logs
  2. docker logs --tail 0
  3. output all the logs instead of no log

Describe the results you received:
output all the logs

Describe the results you expected:
output no log

Additional information you deem important (e.g. issue happens only occasionally):
--tail 1 or other positive values works as expected.

Output of docker version:

(paste your output here)
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:38 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:20 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

(paste your output here)
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 243
Server Version: 17.09.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 202
 Dirperm1 Supported: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 3.13.0-135-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.798GiB
Name: lab-9aee27ce-be7c-44cb-8961-f933193618ea-k8-jumphost
ID: XCF7:KYPA:SGZY:HCO7:R3B7:M5ES:XJJO:G2IG:WVXO:R4Q6:ZM5I:6EKH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

@kobayashi
Copy link

Which image do you use?
I tried it on my vagrant environment. It seems to work well.

vagrant@vagrant-ubuntu-trusty-64:~$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES
e10c0e92d969        hello-world         "/hello"            6 minutes ago       Exited (0) 6 minutes ago                       hello
vagrant@vagrant-ubuntu-trusty-64:~$ docker logs --tail 0 hello
vagrant@vagrant-ubuntu-trusty-64:~$ docker logs --tail -1 hello

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://cloud.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

vagrant@vagrant-ubuntu-trusty-64:~$

My env is followings.

vagrant@vagrant-ubuntu-trusty-64:~$ docker version
Client:
 Version:      17.09.0-ce
 API version:  1.32
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:42:38 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:20 2017
 OS/Arch:      linux/amd64
 Experimental: false
vagrant@vagrant-ubuntu-trusty-64:~$ docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 1
Server Version: 17.09.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 3
 Dirperm1 Supported: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 apparmor
Kernel Version: 3.13.0-135-generic
Operating System: Ubuntu 14.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 489.9MiB
Name: vagrant-ubuntu-trusty-64
ID: MTXR:NP4Q:5SLF:FNWO:CKAB:ABAN:S645:ADQC:BSGT:FF2P:Z2UL:UIRB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false
Server:
 Version:      17.09.0-ce
 API version:  1.32 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   afdb6d4
 Built:        Tue Sep 26 22:41:20 2017
 OS/Arch:      linux/amd64
 Experimental: false

@xiangfeiz
Copy link
Author

I was running an in-house image which writes logs to stdout. '--tail 0' works as expected with docker engine 1.12, 17.05, 17.06 and we only noticed the error on docker engine 17.09.0-ce.

I also tested hello-world image which works as expected. So looks like the issue is related to our image.

@boaz0
Copy link
Member

boaz0 commented Nov 7, 2017

Thanks @xiangfeiz for your report. Closing this as the problem isn't on Moby.
Feel free to write us if something got changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants