Docker commands to run the VCE - innovationOUtside/tm351vm-binder GitHub Wiki
To run the VCE from the commandline, we need to tell dDocker:
- which docker image we want to build a container instance from;
- what port mappings are required that map server ports running inside the container onto ports we can access on the host machine;
- what directories on the host machine we want to be able to see inside the container.
To start the container, we can issue:
- either a
docker run
command, where command includes various explicit switches and settings that define which docker image ; - or a
docker-compose
command, where we download a configuration file and use that to specify what image to use and how to set up shared folders.
docker run
invocations
Assuming that you have created a folder in your home directory (C:\users\yourusername\TM351VCE
on Windows, /Users/yourusername
on Mac, /home/yourusername
on Linux), from a terminal using Mac/Linux or PowerShell prompt using Windows, change directory into C:\users\yourusername\
(Windows) / /Users/yourusername
(Mac) / /home/yourusername
(Linux) and run the command:
Windows:
Using PowerShell, in the folder that contains the TM351VC
folder (eg C:\users\yourusername
), run the command:
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
On Windows command prompt (?), you may have to replace $pwd
with %cd%
. (I'm not sure if the path can then continue or you are stuck with just the current directory?)
If you encounter problems sharing directories, use the full path to the shared directory (eg paths taking the form C:\users\yourusername\TM351VCE\notebooks
rather than $pwd\TM351VCE\notebooks
in the docker run
command).
Mac/Linux:
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
You should now be able to see the notebook server at localhost:35180 and use the token letmein
to gain access.
docker-compose
invocations
Download the docker-compose.yml
file to the directory that contains your TM351VCE
directory (for example, download the file as C:\users\yourusername\docker-compose.yml
/ /Users/yourusername/docker-compose.yml
/ /home/yourusername/docker-compose.yml
From a terminal using Mac/Linux or PowerShell prompt using Windows, change directory into the directory that contains the TM351VCE
folder (eg C:\users\yourusername\
(Windows) / /Users/yourusername
(Mac) / /home/yourusername
(Linux)) and then run the command:
docker-compose up -d
You should now be able to see the notebook server at localhost:35180 and use the token letmein
to gain access.
Additional docker-compose commands
You can stop the container by running the command: docker-compose stop and then restart it by issuing the command docker-compose start
Alternatively, to restart a running container, issue the command docker-compose restart
Pause/unpause the running of the container using the commands: docker-compose pause
/ docker-compose unpause
Force the container to stop: docker-compose kill
Remove stopped container (this will not delete shared folders) : docker-compose rm
Shutdown and remove the container (this will not delete shared folders): `docker-compose down
To restart the VCE, you would then need to run docker-compose up -d
again. This approach can be used if you break the environment in the container somehow and need to create a fresh one.
List running containers: docker-compose ps
View container logs / logfile: docker-compose logs
Show public ports on the container: docker-compose port