nrdg / cloudknot

A python library to run your existing code on AWS Batch
https://nrdg.github.io/cloudknot/
Other
71 stars 17 forks source link

Add the user in the dockerfile, only if the user doesn't exist #135

Closed arokem closed 6 years ago

arokem commented 6 years ago

If you inherit a DockerImage from a hand-crafted base image, you might run into a situation where the user (e.g., the default cloudknot-user) already exists by the time you get here: https://github.com/richford/cloudknot/blob/master/cloudknot/templates/Dockerfile.template#L16

This will make your build of the derived image fail.

Unless, we do something like this: https://unix.stackexchange.com/a/28530

richford commented 6 years ago

Good point. I like the idea of using

id -u ${username} >/dev/null 2>&1 || useradd ${username}

as in the stackexchange answer.

We may also need to pay more attention to how we set up the WORKDIR. I'm guessing this won't be the last issue generated from your experiments using cloudknot with neurodocker.

arokem commented 6 years ago

It's actually not neurodocker, but experiments with a hand-built docker image that includes some other non-python dependencies. The use-case is described here: https://github.com/ccurtis7/diff_classifier, and the base image Dockerfile is here: https://github.com/ccurtis7/diff_classifier/pull/9, adding Fiji (a biomedical image processing application written in java...) as a dependency.

richford commented 6 years ago

Resolved by #139