Skip to content

Latest commit

 

History

History
136 lines (86 loc) · 2.89 KB

File metadata and controls

136 lines (86 loc) · 2.89 KB

Docker environment for API

Build and Run

Here are some guidelines to build and run the docker container for the TeselaGen Python Client.

  1. Build the docker image from the Dockerfile

    sh build.sh
  2. Run the docker container from the (already built) docker image

    sh run.sh
  3. Alternatively, build the docker image and run the docker container in one line.

    sh build.sh && sh run.sh
  4. Once the docker container is running, you can access jupyter notebooks from your browser at localhost:8888

  5. 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 of run.sh) to mount a directory into /home/development/Notebooks.

Others

Here we list some common commands.

  1. To list runing containers

    docker ps

    Use the --all flag to list all containers

    docker ps --all
  2. To list all images

    docker images --all
  3. Restart the container

    Replace containerName

    docker restart containerName
  4. Stop the running container

    Replace containerName

    docker stop containerName
  5. Start the container

    Replace containerName

    docker start containerName
  6. Remove the container

    Replace containerName

    Use the --force flag to force the removal of a running container.

    docker rm containerName --force
  7. Remove the image

    Replace imageName and versionTag

    Use the flag --force to force the removal of the image.

    docker rmi imageName:$versionTag --force
  8. To pretty print the list of containers using a Go template

    docker ps --all --format 'table {{.Names}}\t{{.Image}}\t{{.Ports}}\t{{.Status}}\t{{.ID}}\t{{.Mounts}}' --no-trunc
  9. Open a terminal from inside the container

    Replace containerName

    docker exec --tty --interactive containerName bash
  10. 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"
  11. Get the token of the Jupyter Notebook that runs inside the container

    Replace containerName

    Calling bash with the -c option 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 list inside the container, to get the notebook token.

    docker exec --tty --interactive containerName bash -c "jupyter notebook list"