Skip to content

V2:docker compose ps command and docker-compose ps command get content not the same #9705

Closed
@LatreviousYI

Description

@LatreviousYI

Description

Steps to reproduce the issue:
1.docker compose -f /home/kerwin/process_file/test_fastapi_v2_update/yaml/test_fastapi_v2_update.yaml ps
2.docker-compose -f /home/kerwin/process_file/test_fastapi_v2_update/yaml/test_fastapi_v2_update.yaml ps
3.

Describe the results you received:
output of docker compose

# docker compose -f test_fastapi_v2_update.yaml ps
NAME                COMMAND                  SERVICE             STATUS              PORTS
test_fastapi        "bash -c 'python tes…"   test_fastapi        running             0.0.0.0:6898->8000/tcp, :::6898->8000/tcp
test_fastapi_v1     "bash -c 'python tes…"   test_fastapi_v1     running             0.0.0.0:9898->8000/tcp, :::9898->8000/tcp
test_fastapi_v2     "bash -c 'python tes…"   test_fastapi_v2     running             0.0.0.0:9899->8000/tcp, :::9899->8000/tcp

Describe the results you expected:
output of docker-compose

# docker-compose -f test_fastapi_v2_update.yaml ps
     Name                Command           State                    Ports                  
-------------------------------------------------------------------------------------------
test_fastapi_v1   bash -c python test.py   Up      0.0.0.0:9898->8000/tcp,:::9898->8000/tcp
test_fastapi_v2   bash -c python test.py   Up      0.0.0.0:9899->8000/tcp,:::9899->8000/tcp

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

Compose file:

# cat test_fastapi_v2_update.yaml
services:
  test_fastapi_v1:
    command: bash -c "python test.py"
    container_name: test_fastapi_v1
    image: python:fastapi_comp
    logging:
      driver: json-file
      options:
        max-file: '3'
        max-size: 500mb
    ports:
    - 9898:8000
    restart: always
    volumes:
    - /home/kerwin/test_fastpi:/home/kerwin/test_fastpi
    working_dir: /home/kerwin/test_fastpi
  test_fastapi_v2:
    command: bash -c "python test.py"
    container_name: test_fastapi_v2
    image: python:fastapi_comp
    logging:
      driver: json-file
      options:
        max-file: '3'
        max-size: 500mb
    ports:
    - 9899:8000
    restart: always
    volumes:
    - /home/kerwin/test_fastpi:/home/kerwin/test_fastpi
    working_dir: /home/kerwin/test_fastpi

Output of docker compose version:
Docker Compose version v2.6.0

Output of docker info:

root@ubuntu:/home/kerwin/process_file# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 5
  Running: 4
  Paused: 0
  Stopped: 1
 Images: 9
 Server Version: 20.10.17
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc version: v1.1.2-0-ga916309
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-41-generic
 Operating System: Ubuntu 22.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 1.898GiB
 Name: ubuntu
 ID: LRX2:64LM:NEGK:BAPB:M2FO:6XXV:RNDE:PGM3:3ZS6:VDNW:CN2C:BACX
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Additional environment details:
ubuntu-22.04

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions