ucam-department-of-psychiatry / crate

Create and use de-identified research databases. Preprocess, extract text, anonymise/de-identify, link, apply natural language processing, query for research, manage consent for contact.
GNU General Public License v3.0
19 stars 7 forks source link

Installer broken with Docker Compose >= 2.14.1 #110

Closed martinburchell closed 1 year ago

martinburchell commented 1 year ago

Since Docker Compose 2.14.1, the installer fails with this output:


e497f00c1145 Extracting [==================================================>]     504B/504B
e497f00c1145 Extracting [==================================================>]     504B/504B
e497f00c1145 Pull complete 
crate_workers Pulled 
/bin/bash: /crate/venv/bin/activate: No such file or directory
/bin/bash: crate_print_demo_crateweb_config: command not found
Traceback (most recent call last):
  File "/home/runner/work/crate/crate/installer/installer.py", line 1231, in <module>
    main()
  File "/home/runner/work/crate/crate/installer/installer.py", line 1212, in main
    installer.install()
  File "/home/runner/work/crate/crate/installer/installer.py", line 317, in install
    self.create_local_settings()
  File "/home/runner/work/crate/crate/installer/installer.py", line 562, in create_local_settings
    self.run_crate_command(
  File "/home/runner/work/crate/crate/installer/installer.py", line 356, in run_crate_command
    self.run_bash_command_inside_docker(
  File "/home/runner/work/crate/crate/installer/installer.py", line 1042, in run_bash_command_inside_docker
    docker.compose.run(
  File "/home/runner/.virtualenvs/crate-installer/lib/python3.8/site-packages/python_on_whales/components/compose/cli_wrapper.py", line 450, in run
    result = run(full_cmd, tty=tty)
  File "/home/runner/.virtualenvs/crate-installer/lib/python3.8/site-packages/python_on_whales/utils.py", line 177, in run
    raise DockerException(
python_on_whales.exceptions.DockerException: The docker command executed was `/usr/bin/docker compose run --rm crate_workers /bin/bash -c source /crate/venv/bin/activate; crate_print_demo_crateweb_config --leave_placeholders > $CRATE_WEB_LOCAL_SETTINGS`.
It returned with code 127
The content of stdout can be found above the stacktrace (it wasn't captured).
The content of stderr can be found above the stacktrace (it wasn't captured).
Error: Process completed with exit code 1.

on earlier versions, the output was:

e497f00c1145 Extracting [==================================================>]     504B/504B
e497f00c1145 Extracting [==================================================>]     504B/504B
e497f00c1145 Pull complete 
crate_workers Pulled 
#1 [internal] load build definition from crate.Dockerfile
#1 transferring dockerfile: 13.57kB done
#1 DONE 0.0s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.8-slim-buster
#3 ...

#4 [auth] library/python:pull token for registry-1.docker.io
#4 DONE 0.0s

#3 [internal] load metadata for docker.io/library/python:3.8-slim-buster
#3 DONE 4.4s

#5 [internal] load build context
#5 DONE 0.0s

#6 [1/5] FROM docker.io/library/python:3.8-slim-buster@sha256:0b92aced9b0e52b16870a7c096b9325b57e065ed6ab7c2b5b018f849f9b5e269
#6 resolve docker.io/library/python:3.8-slim-buster@sha256:0b92aced9b0e52b16870a7c096b9325b57e065ed6ab7c2b5b018f849f9b5e269 done
#6 sha256:a4d3f9f008ef6d0d35c51c1913566276174bcb18bc3291526372ca41d891f1eb 0B / 2.78MB 0.1s
#6 sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2 0B / 11.29MB 0.1s
#6 sha256:0b92aced9b0e52b16870a7c096b9325b57e065ed6ab7c2b5b018f849f9b5e269 988B / 988B done
#6 sha256:1e14068484fd811505a75d6b3ecf01a8e331f6772a11124e1e02cd11ae7e6950 1.37kB / 1.37kB done
#6 sha256:fdd2debbebbc307b549ff11e56d57c30f2832fd69c5a2b21f974a90ae2edeb03 7.56kB / 7.56kB done
#6 sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c 0B / 27.14MB 0.1s
#6 sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c 6.29MB / 27.14MB 0.2s
#6 sha256:a4d3f9f008ef6d0d35c51c1913566276174bcb18bc3291526372ca41d891f1eb 2.78MB / 2.78MB 0.3s done
#6 sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2 1.20MB / 11.29MB 0.3s
#6 sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c 18.87MB / 27.14MB 0.3s
#6 sha256:e88f461f2767a7a0df517d0b092d74f391361bea8a20a73404479c3df3c7bca1 0B / 234B 0.3s
#6 sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2 9.44MB / 11.29MB 0.4s
#6 sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c 27.14MB / 27.14MB 0.4s done
#6 sha256:e88f461f2767a7a0df517d0b092d74f391361bea8a20a73404479c3df3c7bca1 234B / 234B 0.4s done
#6 sha256:9f49a518639b56b4b2b8b8ae9b85a7b8e0103cb0c10024f631958f4368129f28 0B / 3.18MB 0.4s
#6 sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2 11.29MB / 11.29MB 0.4s done
#6 sha256:9f49a518639b56b4b2b8b8ae9b85a7b8e0103cb0c10024f631958f4368129f28 3.18MB / 3.18MB 0.5s done
#6 extracting sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c
#6 ...

#5 [internal] load build context
#5 transferring context: 197.94MB 2.1s done
#5 DONE 2.1s

#6 [1/5] FROM docker.io/library/python:3.8-slim-buster@sha256:0b92aced9b0e52b16870a7c096b9325b57e065ed6ab7c2b5b018f849f9b5e269
#6 extracting sha256:548fcab5fe888f589dd092c68b813bfd65359878bd1950d6b753f749e82ebd7c 1.7s done
#6 extracting sha256:a4d3f9f008ef6d0d35c51c1913566276174bcb18bc3291526372ca41d891f1eb 0.1s
#6 extracting sha256:a4d3f9f008ef6d0d35c51c1913566276174bcb18bc3291526372ca41d891f1eb 0.1s done
#6 extracting sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2
#6 extracting sha256:4066f60fce23691442cf89cf4268f36a297199dbda0541b45b473bcbb925d9b2 0.4s done
#6 extracting sha256:e88f461f2767a7a0df517d0b092d74f391361bea8a20a73404479c3df3c7bca1 done
#6 extracting sha256:9f49a518639b56b4b2b8b8ae9b85a7b8e0103cb0c10024f631958f4368129f28
#6 extracting sha256:9f49a518639b56b4b2b8b8ae9b85a7b8e0103cb0c10024f631958f4368129f28 0.2s done
#6 DONE 4.3s

#7 [2/5] RUN adduser --disabled*** '' --uid 1001 crate

ie the docker compose run line to create the local settings no longer executes the commands in the crate.Dockerfile to set up the virtual environment before the command is run. Hence the No such file or directory error.

martinburchell commented 1 year ago

The problem is that since Docker Compose 2.14.1, an attempt will be made to pull any named image before building it from a Dockerfile. Fixed in ab09f07f04206a6acb0235be345bf1db5840c4da