Skip to content

Update docker_run.sh #8

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker_run.sh
Original file line number Diff line number Diff line change
@@ -29,8 +29,11 @@ rest=$@
IMAGE="${IMAGE:-sg2ada:latest}"

CONTAINER_ID=$(docker inspect --format="{{.Id}}" ${IMAGE} 2> /dev/null)
WORKDIR=$(pwd)
if [[ "${CONTAINER_ID}" ]]; then
docker run --gpus all -it --rm -v `pwd`:/scratch --user $(id -u):$(id -g) \
docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 --gpus all \
--mount type=bind,source="$WORKDIR",target=/workspace \
-it --rm -v `pwd`:/scratch --user $(id -u):$(id -g) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"-v pwd:/scratch" mounts your current working directory under /scratch. It looks like your change adds another bindmount for workdir under /workspace. So both /scratch and /workspace should be pointing to your host's current dir.

Perhaps you were using paths like /workspace/something.pkl when /scratch/something.pkl would've worked without the above change?

I will comment on the bug. The docker_run.sh is kind of a sample thing that I expect everyone to adapt to their needs. These kinds of scripts never do exactly what multiple people want from docker run, so the simpler they are in a repo like this, the better.. this way it's easier to understand it and fork it to one's own needs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes thanks Janne - /scratch/something.pkl seems fine. Just need some help for newbies in readme

I like the shell wrapper - it helps hide the guff and also get the user credentials correct. I've dived into docker and end up in the bash - then spitting out images which can't be seen by the host / this is solved by the user id parameter - so far - so good - works elegantly.

--workdir=/scratch -e HOME=/scratch $IMAGE $@
else
echo "Unknown container image: ${IMAGE}"