ReproNim / neurodocker

Generate custom Docker and Singularity images, and minimize existing containers
https://www.repronim.org/neurodocker/
Apache License 2.0
330 stars 97 forks source link

Adding Fuzzy to Neurodocker #398

Open gkiar opened 3 years ago

gkiar commented 3 years ago

Hey all,

Recently we've made a lot of progress on a project called Fuzzy, which enables the resting of numerical uncertainty in pipelines. With multistage Docker builds, it has also become very easy to integrate the perturbed version of libraries into other systems, e.g. https://github.com/verificarlo/fuzzy#using-fuzzy-in-multi-stage-builds

I think it would be great to add a switch to neurodocker, such as --fuzzy, where we could add a build stage which simply copies over perturbed libraries to the environment such that the stability of an arbitrary pipeline/environment configuration can be tested.

What would be the best way to implement this?

Thanks!

kaczmarj commented 3 years ago

@gkiar - looks cool! i would take a look at https://github.com/ReproNim/neurodocker/pull/378. i'm working on refactoring neurodocker there, and i think using that code, it should be easier to add things like fuzzy.

does fuzzy primarily use COPY instructions? we might not even need multi-stage builds. i think this would work:

COPY --from=verificarlo/fuzzy:latest /opt/mca-libmath/libmath.so /opt/mca-libmath/
kaczmarj commented 3 years ago

Yes I was able to copy from a different docker image without using multi-stage builds.

the dockerfile:

FROM alpine:3.12
COPY --from=alpine:3.10 /etc/os-release /etc/

build:

docker build -t test-copy - < Dockerfile

test that os-release points to the older alpine:

$ docker run --rm test-copy cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.10.9
PRETTY_NAME="Alpine Linux v3.10"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
gkiar commented 3 years ago

Awesome, you're totally right in that copying over the recompiled libraries is enough to do the trick, I just hadn't realized you can do that arbitrarily from tagged images :)

I'll take a look at #378 this week in case more sets of eyes help in the integration of your PR to the main repo, then we can build the quick fuzzy flag on top.

Remi-Gau commented 1 year ago

@gkiar is this something you still want to integrate in neurodocker?