Here are some guidelines to build and run the docker container for the TeselaGen Python Client.
-
Build the docker image from the
Dockerfilesh build.sh
-
Run the docker container from the (already built) docker image
sh run.sh
-
Alternatively, build the docker image and run the docker container in one line.
sh build.sh && sh run.sh -
Once the docker container is running, you can access jupyter notebooks from your browser at
localhost:8888 -
You can create your own run command to mount folders from your computer into the container. Alternatively, you may use the
sh run_dev.sh <path/to/local/folder>command (instead ofrun.sh) to mount a directory into/home/development/Notebooks.
Here we list some common commands.
-
To list runing containers
docker ps
Use the
--allflag to list all containersdocker ps --all
-
To list all images
docker images --all
-
Restart the container
Replace
containerNamedocker restart containerName
-
Stop the running container
Replace
containerNamedocker stop containerName
-
Start the container
Replace
containerNamedocker start containerName
-
Remove the container
Replace
containerNameUse the
--forceflag to force the removal of a running container.docker rm containerName --force
-
Remove the image
Replace
imageNameandversionTagUse the flag
--forceto force the removal of the image.docker rmi imageName:$versionTag --force -
To pretty print the list of containers using a
Gotemplatedocker ps --all --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}\t{{.Status}}\t{{.ID}}\t{{.Mounts}}' --no-trunc -
Open a terminal from inside the container
Replace
containerNamedocker exec --tty --interactive containerName bash -
Verify the library is installed
-
From inside the container
pip freeze | grep --ignore-case teselagen -
From outside the container
docker exec --tty --interactive tgclient bash -c "pip freeze | grep --ignore-case teselagen"
-
-
Get the token of the
Jupyter Notebookthat runs inside the containerReplace
containerNameCalling
bashwith the-coption allows to append a string with the specific commands that are going to be run directly inside the container.Here is an example to run the command
jupyter notebook listinside the container, to get the notebook token.docker exec --tty --interactive containerName bash -c "jupyter notebook list"