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

docker image expects missing package uptime #1113

Closed
psadil opened this issue May 17, 2023 · 21 comments
Closed

docker image expects missing package uptime #1113

psadil opened this issue May 17, 2023 · 21 comments

Comments

@psadil
Copy link

psadil commented May 17, 2023

As with #1042, I am trying to run mideface through docker. This fails because the package uptime is expected but not present in the official image (which I understand to be this)

# as of this issue, 7.3.2 is the latest image pushed to hub.docker
$ curl -X GET https://registry.hub.docker.com/v2/repositories/freesurfer/freesurfer/tags | jq '.. | .name?'   
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4623    0  4623    0     0    680      0 --:--:--  0:00:06 --:--:--  1092
"7.3.1"
"7.3.0"
"7.3.2"
"7.2.0"
"7.1.1"
"6.0"

$ docker run --rm -it -v $(pwd):/data freesurfer/freesurfer:7.3.2 mideface --i /data/volume.nii.gz --o /data/defaced.nii.gz
Unable to find image 'freesurfer/freesurfer:7.3.2' locally
7.3.2: Pulling from freesurfer/freesurfer
1b3417e31a5e: Pull complete 
809fe483e885: Pull complete 
da3bfb95259d: Pull complete 
d43e48d23580: Pull complete 
108d6329e0ee: Pull complete 
9efd074fb2d3: Pull complete 
Digest: sha256:af1f78ae2fae323470ff49a29b2a94cf51f129d50b7d60a094eed2c7d0f07438
Status: Downloaded newer image for freesurfer/freesurfer:7.3.2
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Wed May 17 13:30:54 UTC 2023

setenv SUBJECTS_DIR /usr/local/freesurfer/subjects
cd /root
/usr/local/freesurfer/bin/mideface --i /data/volume.nii.gz --o /data/defaced.nii.gz
-rwxrwxr-x 1 root root 27366 Aug  4  2022 /usr/local/freesurfer/bin/mideface

freesurfer-linux-centos8_x86_64-7.3.2-20220804-6354275
$Id$
Linux d02b21b81ae6 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
pid 1
UseXvfb 0
samseg --i /data/volume.nii.gz --o /data/tmpdir.midefacer.1/samseg --threads 1 --block-coordinate-descent --options /usr/local/freesurfer/average/mideface-atlas/samseg-options.json
uptime: Command not found.
upt: Subscript out of range.
ERROR:

An answer in #1042 was to manually set an environment variable that would prevent fs_time from trying to call uptime. Would the developers consider fixing the Dockerfile or documenting the requirement? Potential solutions include:

  • Adding a note about setting FS_TIME_ALLOW=0 to the README for the Docker Image, as is done for FS_LICENSE
  • Overriding the default environment variable during image creation (e.g., here)
  • Installing uptime (e.g., here)
@tzuifurther
Copy link

Maybe the basic centos8 image has error, the new centos8 has the uptime

@psadil
Copy link
Author

psadil commented Jul 18, 2023

That would suggest a fourth solution, which would be

  • when building the official FreeSurfer image (defined something like here), update the base image to the new centos8 one (or, one with uptime)

@tzuifurther
Copy link

I think rebuild it, and it will include it. I run the official FreeSurfer image, and it show the redhat-release version is centos8.

@psadil
Copy link
Author

psadil commented Jul 19, 2023

Can you point to where the official FreeSurfer image is hosted? From what I'm seeing, the list on DockerHub is the same as when the issue was opened

❯ curl -X GET https://registry.hub.docker.com/v2/repositories/freesurfer/freesurfer/tags | jq '.. | .name?' | grep -v null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4619    0  4619    0     0  29021      0 --:--:-- --:--:-- --:--:-- 29800
"7.3.1"
"7.3.0"
"7.3.2"
"7.2.0"
"7.1.1"
"6.0"

and no new images have been pushed with those tags

❯ curl -X GET https://registry.hub.docker.com/v2/repositories/freesurfer/freesurfer/tags | jq | grep tag_last_pushed      
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4619    0  4619    0     0  31134      0 --:--:-- --:--:-- --:--:-- 32076
      "tag_last_pushed": "2022-12-01T22:58:58.731363Z",
      "tag_last_pushed": "2022-12-01T22:52:25.799325Z",
      "tag_last_pushed": "2022-12-01T22:37:20.491666Z",
      "tag_last_pushed": "2021-09-02T02:18:53.227082Z",
      "tag_last_pushed": "2020-07-27T20:46:38.314139Z",
      "tag_last_pushed": "2017-09-01T23:20:36.673681Z",

@buildqa
Copy link
Contributor

buildqa commented Jul 20, 2023

All of our CentOS8/Rocky8 machines have /usr/bin/uptime installed by default because it is part of the baseos repo (system and process monitoring). Not clear to me this should become an added dependency for the installers.

@tzuifurther
Copy link

tzuifurther commented Jul 21, 2023

Yes, and I build the image from the dockerfile , and its version is centos7. I use the official image is Centos8.

$ docker run --rm -it freesurfer/freesurfer:7.3.2 cat /etc/redhat-release
CentOS Stream release 8
$ docker run --rm -it freesurfer/freesurfer:7.3.2 which uptime
which: no uptime in (/usr/local/freesurfer/bin:/usr/local/freesurfer/fsfast/bin:/usr/local/freesurfer/tktools:/usr/local/freesurfer/mni/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

@psadil
Copy link
Author

psadil commented Jul 21, 2023

@tzuifurther , yep, that's the issue.

For what it's worth, the currently listed base image (centos:7) contains uptime in a location that is in the path of the official FreeSurfer image

docker run --rm -it centos:7 ls -l /usr/bin/uptime          
-rwxr-xr-x 1 root root 68840 Sep 30  2020 /usr/bin/uptime

So, it's not clear to me why the official FreeSurfer image is missing uptime

@buildqa
Copy link
Contributor

buildqa commented Jul 21, 2023

I don't know who made/posted the archive you are referencing, but there are no copies of system commands/utilities like uptime in the tar archives on the official release page, https://surfer.nmr.mgh.harvard.edu/fswiki/rel7downloads. We recommend using the binary rpm and deb installers. I can check those installers will install uptime if not already installed on the system, but the tar archives are not a substitute for the installers.

@psadil
Copy link
Author

psadil commented Jul 21, 2023

Hi @buildqa , I wasn't referencing an archive but the base image of the official FreeSurfer docker container, an image which I understand to be defined here.

@buildqa
Copy link
Contributor

buildqa commented Jul 21, 2023

I'll apologize for any confusion, but I don't think we have anyone officially supporting a dockerfile script, i.,e., I'm not familiar with the userid who posted that dockerfile script. Instead of downloading a tar archive and trying to hardcode the install of specific commands/utilities in that script, I would as ROOT download and run the appropriate binary freesurfer .rpm installer via the link I referenced above, e.g., "yum install -y ./freesurfer-CentOS7-7.2.0-1.x86_64.rpm". Then as the very last step in the dockerfile script, e..g, after setting a default PATH, adding any other environment variables you want, userids's, etc., export FREESURFER_HOME (as installed by 7.2.0 CentOS7 rpm) to be /usr/local/freesurfer/7.2.0-1 Then finally source the $FREESURFER_HOME/SetUpFreeSurfer.{sh,csh} script. Or it's download and run the FS binary rpm installer at some appropriate step in the dockerfile script, and then save setting up the freesurfer environment - which includes its setup script modifying the head of PATH for freesurfer - to be the last step. BTW - I've added the "update" command as a dependency for the dev build rpm's and that should make it into the next release.

@psadil
Copy link
Author

psadil commented Jul 21, 2023

Ah, thanks for clarifying. Just to be clear, I don't have an issue with building a docker image that has FreeSurfer myself (the approach you've outlined has worked for me). Instead, this issue was more about trying to use what I understood to be the "official" FreeSurfer image (again, hosted here: https://hub.docker.com/r/freesurfer/freesurfer/#!), an image that I had assumed was built with the Dockerfile on the main branch of this repo. It's the image on hub.docker that doesn't have uptime. Perhaps it wasn't built with the Dockerfile on this repo

@tzuifurther
Copy link

@buildqa maybe we could make github action to build the image ?

@buildqa
Copy link
Contributor

buildqa commented Jul 31, 2023

I think a container for the latest release was added as freesurfer/freesurfer:7.4.1 last week

@psadil
Copy link
Author

psadil commented Jul 31, 2023

This is to confirm that there I can see a new freesurfer/freesurfer:7.4.1. It still lacks the uptime command

$ docker run --rm -it freesurfer/freesurfer:7.4.1 cat /etc/redhat-release
CentOS Stream release 8
$ docker run --rm -it freesurfer/freesurfer:7.4.1 which uptime          
which: no uptime in (/usr/local/freesurfer/bin:/usr/local/freesurfer/fsfast/bin:/usr/local/freesurfer/tktools:/usr/local/freesurfer/mni/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

@pwighton
Copy link
Contributor

I've updated the freesurfer/freesurfer:7.4.1 container. It should now contain uptime. I used this dockerfile to build the container.

@psadil
Copy link
Author

psadil commented Jul 31, 2023

@pwighton , confirming that I can see the updated image with uptime. Thank you!

Would you all consider doing something for the previous images, too? Rebuilding the images with uptime would of course be helpful, but working with FS_TIME_ALLOW=0 could also suffice.

@buildqa
Copy link
Contributor

buildqa commented Jul 31, 2023

A forthcoming change is going to eliminate the use of uptime if it's not installed on the system. So this should not be an issue with future releases or for development builds once that change is propagated to the dev branch.

@pwighton
Copy link
Contributor

Thanks @psadil, I can work on updating the previous versions. It might take a few days though.

@psadil
Copy link
Author

psadil commented Jul 31, 2023

Thanks! Feel free to close this issue whenever it's convenient

@dngreve
Copy link
Contributor

dngreve commented Jul 31, 2023 via email

@buildqa buildqa closed this as completed Aug 1, 2023
@pwighton
Copy link
Contributor

pwighton commented Aug 1, 2023

I've updated the following freesurfer/freesurfer containers so that they include uptime:

  • 7.4.1
  • 7.3.2
  • 7.3.1
  • 7.3.0
  • 7.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants