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

[APIv2] log output of container is in binary format #6628

Closed
jgallucci32 opened this issue Jun 16, 2020 · 8 comments
Closed

[APIv2] log output of container is in binary format #6628

jgallucci32 opened this issue Jun 16, 2020 · 8 comments
Assignees
Labels
HTTP API Bug is in RESTful API kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue

Comments

@jgallucci32
Copy link
Contributor

jgallucci32 commented Jun 16, 2020

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description
The log output of a container using APIv2 is binary output and not plaintext.

Steps to reproduce the issue:

  1. Run a container
podman run -d --name hello-world hello-world
  1. Use cURL to view the logs using the API
curl --unix-socket /run/podman/podman.sock 'http://docker/v1.24/containers/hello-world/logs?stdout=1'

Describe the results you received:
The following warning is displayed

Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.

Describe the results you expected:
Logs should output in plaintext. Confirmed this is how it works with Docker API.

Additional information you deem important (e.g. issue happens only occasionally):
When using the --output - flag with cURL as suggested by the warning the output is incorrectly formatted. Here is the output for the hello-world container

Hello from Docker!JThis message shows that your installation appears to be working correctly.:To generate this message, Docker took the following steps:2 1. The Docker client contacted the Docker daemon.I 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
                                               (amd64)L 3. The Docker daemon created a new container from that image which runs theB    executable that produces the output you are currently reading.N 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal.FTo try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashAShare images, automate workflows, and more with a free Docker ID: https://hub.docker.com/#For more examples and ideas, visit:% https://docs.docker.com/get-started/

Output of podman version:

Version:      2.0.0-dev
API Version:  1
Go Version:   go1.14.3
Git Commit:   d857275901e8c1ea7515360631e5894018e17f30
Built:        Fri Jun  5 17:00:00 2020
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.15.0-dev
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.18-0.6.dev.git50aeae4.fc33.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.18-dev, commit: 51e91bbc42aaf0676bb4023fb86f00460bf7a0a2'
  cpus: 4
  distribution:
    distribution: fedora
    version: "33"
  eventLogger: file
  hostname: gallucci-fedora.devlnk.net
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.7.0-1.fc33.x86_64
  linkmode: dynamic
  memFree: 15180460032
  memTotal: 16783962112
  ociRuntime:
    name: crun
    package: crun-0.13-2.fc33.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.13
      commit: e79e4de4ac16da0ce48777afb72c6241de870525
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 4294963200
  swapTotal: 4294963200
  uptime: 210h 52m 47.56s (Approximately 8.75 days)
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 10
    paused: 0
    running: 4
    stopped: 6
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 5
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 1
  Built: 1591401600
  BuiltTime: Fri Jun  5 17:00:00 2020
  GitCommit: d857275901e8c1ea7515360631e5894018e17f30
  GoVersion: go1.14.3
  OsArch: linux/amd64
  Version: 2.0.0-dev

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.0.0-0.121.dev.git1fcb678.fc33.x86_64```

Additional environment details (AWS, VirtualBox, physical, etc.):
Fedora 33 (Rawhide Prerelease)

@openshift-ci-robot openshift-ci-robot added kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. labels Jun 16, 2020
@jgallucci32 jgallucci32 changed the title [ [APIv2] log output of container is in binary format Jun 16, 2020
@mheon mheon added HTTP API Bug is in RESTful API and removed kind/feature Categorizes issue or PR as related to a new feature. labels Jun 17, 2020
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 20, 2020

@jgallucci32 If you do this with Docker, does it give you clean output?

@rhatdan
Copy link
Member

rhatdan commented Jul 20, 2020

@QiWang19 PTAL

@jgallucci32
Copy link
Contributor Author

@rhatdan Yes, the output with Docker is the same with cURL as it would be with the CLI. When using the --output flag the Podman API returns the text but return characters are not formatted properly so it is inconsistent with Docker.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Aug 20, 2020

@QiWang19 or @ashley-cui Did you gals ever look at this?

@ashley-cui
Copy link
Member

Started poking around, and didn't get very far before getting distracted. I can probably pick it up tomorrow or next week, but will need help with it

@ashley-cui
Copy link
Member

@jgallucci32 looks like this is docker behavior too..

$ curl --unix-socket /var/run/docker.sock http://localhost/containers/hello-world/logs?stdout=true
Warning: Binary output can mess up your terminal. Use "--output -" to tell 
Warning: curl to output it to your terminal anyway, or consider "--output 
Warning: <FILE>" to save to a file.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
HTTP API Bug is in RESTful API kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. stale-issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants