containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
24k stars 2.43k forks source link

API v2 restart a container: query parameter "t" seems not to work #6128

Closed Edward5hen closed 4 years ago

Edward5hen commented 4 years ago

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

/kind bug

Description

query parameter "t" seems not to work. I'm testing this following the doc - http://docs.podman.io/en/latest/_static/api.html#operation/libpodRestartContainer. No matter which value I set in the data field -d '{"t":$int}', it would take the default timeout 10s to restart the container.

Steps to reproduce the issue:

  1. Set up the APIv2 service

  2. podman run -d --name testctn docker.io/library/alpine sleep 1000

  3. curl -v -X POST -H 'Content-type:application/json' -d '{"t":300}' http://localhost:8081/v1.40/libpod/containers/testctn/restart

Describe the results you received: restart the container with default timeout 10s

Describe the results you expected: restart the container with the timeout I set 300s

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

[root@Fedora31 libpod-1.9.1]# podman version
Version:            1.9.1
RemoteAPI Version:  1
Go Version:         go1.13.9
Built:              Fri May  8 12:33:46 2020
OS/Arch:            linux/amd64
[root@Fedora31 libpod-1.9.1]# podman version
Version:            1.9.1
RemoteAPI Version:  1
Go Version:         go1.13.9
Built:              Fri May  8 12:33:46 2020
OS/Arch:            linux/amd64

Output of podman info --debug:

[root@Fedora31 libpod-1.9.1]# podman info --debug
debug:
  compiler: gc
  gitCommit: ""
  goVersion: go1.13.9
  podmanVersion: 1.9.1
host:
  arch: amd64
  buildahVersion: 1.14.8
  cgroupVersion: v2
  conmon:
    package: conmon-2.0.15-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.15, commit: 4152e6044da92e0c5f246e5adf14c85f41443759'
  cpus: 2
  distribution:
    distribution: fedora
    version: "31"
  eventLogger: file
  hostname: Fedora31
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.3.7-301.fc31.x86_64
  memFree: 1069326336
  memTotal: 2077401088
  ociRuntime:
    name: crun
    package: crun-0.13-2.fc31.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
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 2210394112
  swapTotal: 2214588416
  uptime: 2h 47m 37.57s (Approximately 0.08 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 0
    stopped: 1
  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: 1
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
Edward5hen commented 4 years ago

The similar issue is found to stop a container - http://docs.podman.io/en/latest/_static/api.html#operation/stopContainer, query parameter "t" does not work either.

mheon commented 4 years ago

@baude PTAL

Edward5hen commented 4 years ago

I'm closing this. I mistook the query parameters as payloads. The cURL command curl -v -X POST http://localhost:8081/v1.40/libpod/containers/testctn/restart?t=30 works fine.