ssciwr / dockerfile-kernel

Docker kernel for Jupyter Lab
MIT License
5 stars 1 forks source link

Create access to the shell of Docker container #3

Closed MarvinWeitz closed 1 year ago

MarvinWeitz commented 1 year ago

The goal is to create a way to interact with the shell of a Docker container that was build from the latest image in the Jupyter Notebook.

MarvinWeitz commented 1 year ago

The Documentation of the Low Level API shows a way to execute commands inside a container With this I came across multiple problems.

  1. The docker container must be kept running after its creation → done via command="sleep infinity"
  2. The commands are executed similar to docker exec which means they don't access the shell of the command → solved by adding bash -c to the beginning of the command
  3. With this the shell instance isn't kept alive. Changing the working directory via cd won't have an effect in the next execution → solved by tracking the working directory in a variable and passing it to the exec_create function

This now works, but its a little hacky...

MarvinWeitz commented 1 year ago

This is now implemented in a better way in the shell-interface branch