docker / compose

Define and run multi-container applications with Docker
https://docs.docker.com/compose/
Apache License 2.0
33.25k stars 5.15k forks source link

Failed to execute script docker-compose #6830

Closed itssadon closed 5 years ago

itssadon commented 5 years ago

Description of the issue

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:18:17 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:17:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker-compose config (Make sure to add the relevant -f and other flags)

services:
  db:
    environment:
      POSTGRES_DB: pyconng_dev
      POSTGRES_PASSWORD: pyconng
      POSTGRES_USER: pyconng
    image: postgres:10.1-alpine
    volumes:
    - postgres_data:/var/lib/postgresql/data:rw
  web:
    build:
      context: /Users/itssadon/Code/pyconng-2019/web
    command: python manage.py runserver 0.0.0.0:8000
    depends_on:
    - db
    environment:
      DATABASE: postgres
      DEBUG: '1'
      SECRET_KEY: devk33s
      SQL_DATABASE: pyconng_dev
      SQL_ENGINE: django.db.backends.postgresql
      SQL_HOST: db
      SQL_PASSWORD: pyconng
      SQL_PORT: '5432'
      SQL_USER: pyconng
    links:
    - db:db
    ports:
    - published: 8000
      target: 8000
    volumes:
    - /Users/itssadon/Code/pyconng-2019/web:/usr/src/web:rw
version: '3.7'
volumes:
  postgres_data: {}

Steps to reproduce the issue

  1. Run docker-compose up -d
  2. Run docker-compose ps -a
  3. Run docker-compose --verbose ps -a

Observed result

Traceback (most recent call last): File "docker-compose", line 6, in File "compose/cli/main.py", line 71, in main File "compose/cli/main.py", line 127, in perform_command File "compose/cli/main.py", line 712, in ps TypeError: '<' not supported between instances of 'Container' and 'Container' [29233] Failed to execute script docker-compose

Expected result

Show all stopped containers (including those created by the run command)

Stacktrace / full error message

compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/Users/itssadon/.docker/config.json', '/Users/itssadon/.dockercfg']
docker.utils.config.find_config_file: Found file at path: /Users/itssadon/.docker/config.json
docker.auth.load_config: Found 'credsStore' section
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/version HTTP/1.1" 200 849
compose.cli.command.get_client: docker-compose version 1.24.1, build 4667896b
docker-py version: 3.7.3
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.1.0j  20 Nov 2018
compose.cli.command.get_client: Docker base_url: http+docker://localhost
compose.cli.command.get_client: Docker version: Platform={'Name': 'Docker Engine - Community'}, Components=[{'Name': 'Engine', 'Version': '19.03.1', 'Details': {'ApiVersion': '1.40', 'Arch': 'amd64', 'BuildTime': '2019-07-25T21:17:52.000000000+00:00', 'Experimental': 'false', 'GitCommit': '74b1e89', 'GoVersion': 'go1.12.5', 'KernelVersion': '4.9.184-linuxkit', 'MinAPIVersion': '1.12', 'Os': 'linux'}}, {'Name': 'containerd', 'Version': 'v1.2.6', 'Details': {'GitCommit': '894b81a4b802e4eb2a91d1ce216b8817763c29fb'}}, {'Name': 'runc', 'Version': '1.0.0-rc8', 'Details': {'GitCommit': '425e105d5a03fabd737a126ad93d62a9eeede87f'}}, {'Name': 'docker-init', 'Version': '0.18.0', 'Details': {'GitCommit': 'fec3683'}}], Version=19.03.1, ApiVersion=1.40, MinAPIVersion=1.12, GitCommit=74b1e89, GoVersion=go1.12.5, Os=linux, Arch=amd64, KernelVersion=4.9.184-linuxkit, BuildTime=2019-07-25T21:17:52.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('pyconng2019_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/networks/pyconng2019_default HTTP/1.1" 404 52
compose.cli.verbose_proxy.proxy_callable: docker inspect_volume <- ('pyconng2019_postgres_data')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/volumes/pyconng2019_postgres_data HTTP/1.1" 404 60
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=pyconng-2019']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dpyconng-2019%22%5D%7D HTTP/1.1" 200 4350
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 3 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('30f9b8f8233ef9eda83aafb3b8038d120f96d4b6971d3105fe7b4ef051031c61')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/containers/30f9b8f8233ef9eda83aafb3b8038d120f96d4b6971d3105fe7b4ef051031c61/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['-g', 'daemon off;'],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['nginx', '-g', 'daemon off;'],
            'Domainname': '',
            'Entrypoint': None,
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
                    'NGINX_VERSION=1.15.12'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('cd5d5928beef7c64bfd2b0c5145c886408d7deb0fbbe023ab90b50354154977c')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/containers/cd5d5928beef7c64bfd2b0c5145c886408d7deb0fbbe023ab90b50354154977c/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['gunicorn', 'pyconng.wsgi:application', '--bind', '0.0.0.0:8000'],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['gunicorn',
                    'pyconng.wsgi:application',
                    '--bind',
                    '0.0.0.0:8000'],
            'Domainname': '',
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('e673eee872d84effe2ed7c409c33d44b14acef4b8a3083bd7736d593b9831214')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.38/containers/e673eee872d84effe2ed7c409c33d44b14acef4b8a3083bd7736d593b9831214/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': ['postgres'],
 'Config': {'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['postgres'],
            'Domainname': '',
            'Entrypoint': ['docker-entrypoint.sh'],
            'Env': ['POSTGRES_USER=pyconng',
                    'POSTGRES_PASSWORD=pyconng',
...
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 712, in ps
TypeError: '<' not supported between instances of 'Container' and 'Container'
[29310] Failed to execute script docker-compose

Additional information

OS version / distribution, docker-compose install method, etc.

ulyssessouza commented 5 years ago

Fixed in master branch and present in docker-compose 1.25.0-rc1

FreelanceDev217 commented 4 years ago

I see the same error again.

docker-compose version 1.25.2, build 698e2846 docker-py version: 4.1.0 CPython version: 2.7.16 OpenSSL version: OpenSSL 1.0.2q 20 Nov 2018

... debconf: delaying package configuration, since apt-utils is not installed Fetched 120 MB in 2min 9s (926 kB/s) Selecting previously unselected package libapparmor1:amd64. (Reading database ... 24555 files and directories currently installed.) Preparing to unpack .../0-libapparmor1_2.13.2-10_amd64.deb ... Unpacking libapparmor1:amd64 (2.13.2-10) ... Selecting previously unselected package libargon2-1:amd64. Preparing to unpack .../1-libargon2-1_0~20171227-0.2_amd64.deb ... Unpacking libargon2-1:amd64 (0~20171227-0.2) ... Selecting previously unselected package dmsetup. Preparing to unpack .../2-dmsetup_2%3a1.02.155-3_amd64.deb ... Unpacking dmsetup (2:1.02.155-3) ... Selecting previously unselected package libdevmapper1.02.1:amd64. Preparing to unpack .../3-libdevmapper1.02.1_2%3a1.02.155-3_amd64.deb ... Unpacking libdevmapper1.02.1:amd64 (2:1.02.155-3) ... Selecting previously unselected package libjson-c3:amd64. Preparing to unpack .../4-libjson-c3_0.12.1+ds-2_amd64.deb ... Unpacking libjson-c3:amd64 (0.12.1+ds-2) ... Selecting previously unselected package libcryptsetup12:amd64. Preparing to unpack .../5-libcryptsetup12_2%3a2.1.0-5+deb10u2_amd64.deb ... Unpacking libcryptsetup12:amd64 (2:2.1.0-5+deb10u2) ... Selecting previously unselected package libidn11:amd64. Preparing to unpack .../6-libidn11_1.33-2.2_amd64.deb ... Unpacking libidn11:amd64 (1.33-2.2) ... Selecting previously unselected package libip4tc0:amd64. Preparing to unpack .../7-libip4tc0_1.8.2-4_amd64.deb ... Unpacking libip4tc0:amd64 (1.8.2-4) ... Selecting previously unselected package libkmod2:amd64. Preparing to unpack .../8-libkmod2_26-1_amd64.deb ... Unpacking libkmod2:amd64 (26-1) ... Selecting previously unselected package systemd. Preparing to unpack .../9-systemd_241-7~deb10u2_amd64.deb ... Unpacking systemd (241-7~deb10u2) ... Setting up libapparmor1:amd64 (2.13.2-10) ... Setting up libargon2-1:amd64 (0~20171227-0.2) ... Setting up libjson-c3:amd64 (0.12.1+ds-2) ... Setting up libidn11:amd64 (1.33-2.2) ... Setting up libip4tc0:amd64 (1.8.2-4) ... Setting up libkmod2:amd64 (26-1) ... Setting up libdevmapper1.02.1:amd64 (2:1.02.155-3) ... Setting up libcryptsetup12:amd64 (2:2.1.0-5+deb10u2) ... Setting up systemd (241-7~deb10u2) ... Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service ??/lib/systemd/system/getty@.service. Traceback (most recent call last): File "docker-compose", line 6, in File "compose\cli\main.py", line 72, in main File "compose\cli\main.py", line 128, in perform_command File "compose\cli\main.py", line 1077, in up File "compose\cli\main.py", line 1073, in up File "compose\project.py", line 548, in up File "compose\service.py", line 367, in ensure_image_exists File "compose\service.py", line 1110, in build File "compose\progress_stream.py", line 30, in stream_output File "compose\progress_stream.py", line 95, in print_output_event File "compose\progress_stream.py", line 13, in write_to_stream File "codecs.py", line 370, in write File "site-packages\colorama\ansitowin32.py", line 41, in write File "site-packages\colorama\ansitowin32.py", line 162, in write File "site-packages\colorama\ansitowin32.py", line 190, in write_and_convert File "site-packages\colorama\ansitowin32.py", line 195, in write_plain_text IOError: [Errno 0] Error [9664] Failed to execute script docker-compose

==================================

alexgzhou commented 4 years ago

Same problem when I use devcontainer in vs-code, in the process of building Dockerfile. Then I tried docker-compose up, same problem. Then I tried docker build ., succeed.

Output of docker-compose version

docker-compose version 1.25.2, build 698e2846
docker-py version: 4.1.0
CPython version: 2.7.16
OpenSSL version: OpenSSL 1.0.2q  20 Nov 2018

Output of docker version

Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea
 Built:             Wed Nov 13 07:22:37 2019
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.4
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       9013bf583a
  Built:            Fri Oct 18 15:50:54 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker-compose config

WARNING: Some services (get_data) use the 'deploy' key, which will be ignored. Compose does not support 'deploy' configuration - use `docker stack deploy` to deploy to a swarm.
networks:
  internal: {}
  mongo_replica:
    driver: overlay
    name: mongo_replica
services:
  get_data:
    build:
      args:
        serv_user: xxx
      context: D:\git\xxx\.devcontainer
      dockerfile: Dockerfile
    cap_add:
    - SYS_PTRACE
    command: bash -c "mkdir -p /root/.ssh; cp /workspace/devcontainers/.gitconfig
      /root/.gitconfig; cp /workspace/devcontainers/.ssh/* /root/.ssh/; chmod 600
      /root/.ssh/id_rsa; chmod 700 /root/.ssh; sleep infinity"
    container_name: get_data
    deploy:
      placement:
        constraints:
        - node.role == manager
      replicas: 1
      resources:
        limits:
          cpus: '3'
          memory: 3072M
        reservations:
          cpus: '0.5'
          memory: 512M
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
    image: python_get_data
    networks:
      internal: null
      mongo_replica: null
    security_opt:
    - seccomp:unconfined
    shm_size: 2g
    volumes:
    - dev_code_volume:/workspace:rw
    - /var/run/docker.sock:/var/run/docker.sock:rw
    - /:/hostfs:rw
    - jupyter_volume:/jupyter:rw
version: '3.7'
volumes:
  dev_code_volume:
    external: true
    name: dev_code_volume
  dev_data_volume:
    name: dev_data_volume
  jupyter_volume:
    name: jupyter_volume

Error message

Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service 鈫?/lib/systemd/system/getty@.service.
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose\cli\main.py", line 72, in main
  File "compose\cli\main.py", line 128, in perform_command
  File "compose\cli\main.py", line 1077, in up
  File "compose\cli\main.py", line 1073, in up
  File "compose\project.py", line 548, in up
[93292 ms] 
  File "compose\service.py", line 351, in ensure_image_exists
  File "compose\service.py", line 1110, in build
  File "compose\progress_stream.py", line 30, in stream_output
  File "compose\progress_stream.py", line 95, in print_output_event
  File "compose\progress_stream.py", line 13, in write_to_stream
  File "codecs.py", line 370, in write
  File "site-packages\colorama\ansitowin32.py", line 41, in write
  File "site-packages\colorama\ansitowin32.py", line 162, in write
  File "site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
  File "site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
IOError: [Errno 0] Error
[22900] Failed to execute script docker-compo
[22900] Failed to execute script docker-compose
ulyssessouza commented 4 years ago

@FreelanceDev217 and @alexgzhou .

Could you please try to reproduce that with docker-compose 1.25.4 ? If yes, please create another issue including your configuration files and .env (if existent)

pythonwood commented 3 weeks ago

it seem happen with profiles: [xx, yy] , 1 docker-compose --profile xx up -d A 2 then edit yaml 3 docker-compose up -d A

solve: docker-compose down and up again