Setting up the VCE on Linux - innovationOUtside/tm351vm-binder GitHub Wiki

...which you think would be the easiest route but is the hardest in a novice environment:

There's a permission issue on the shared folder, so we need to know how to do permissions properly, which I don't, and with a minimum of side effects on host. The easiest solution is possibly something to do with group permissions, but in the mean time, I think the following methods work... (You should only need to follow one of them.)

METHOD 0

Even as root, run the container using a specific user ID:

# Clear any pre-existing tm351vce container
docker rm -f tm351vce

# Start the container with a prespecified user ID ( --user 1234)
docker run --name tm351vce -d -p 35180:8888 -v "$PWD/TM351VCE/notebooks:/home/jovyan/notebooks" -v "$PWD/TM351VCE/openrefine_projects:/home/jovyan/openrefine" -e JUPYTER_TOKEN="letmein" --user 1234 ousefulcoursecontainers/ou-tm351:current

# Set the correct the ownership permissions on/home/jovyan inside the container
# The `docker exec -u 0` command lets us run a command inside the container as root
docker exec -u 0 tm351vce chown -R jovyan /home/jovyan

METHOD 1

As root on host:


# We're going to use a tm351 user on host
# Clear everything to give us a fresh start
userdel tm351
rm -r /home/tm351
docker rm -f tm351vce

# Create a tm351 user
useradd -m -u 1234  tm351

# Add the use to the docker group
sudo usermod -aG docker tm351

# Change to the tm351 user
su - tm351

As user tm351 on host:

docker run --name tm351vce -d -p 35180:8888 -v "$PWD/TM351VCE/notebooks:/home/jovyan/notebooks" -v "$PWD/TM351VCE/openrefine_projects:/home/jovyan/openrefine" -e JUPYTER_TOKEN="letmein" ousefulcoursecontainers/ou-tm351:current

docker exec -u 0 tm351vce chown -R jovyan /home/jovyan
echo "hello world" > TM351VCE/notebooks/hello_from_host.md

METHOD 2

As root on host:

userdel tm351

rm -r /home/tm351

docker rm -f tm351vce
useradd -m -u 1234  tm351

sudo usermod -aG docker tm351

su - tm351

As user tm351 on host, pre-create the directories that are to be mounted in the container:

mkdir -p TM351VCE/notebooks

mkdir -p TM351VCE/openrefine_projects

docker run --name tm351vce -d -p 35180:8888 -v "$PWD/TM351VCE/notebooks:/home/jovyan/notebooks" -v "$PWD/TM351VCE/openrefine_projects:/home/jovyan/openrefine" -e JUPYTER_TOKEN="letmein" ousefulcoursecontainers/ou-tm351:current

echo "hello world" > TM351VCE/notebooks/hello_from_host.md