Run a Docker container in a separate cell
Written by
You can set up a separate environment in any notebook cell by running a Docker container in it. You can utilize this method if you need to use a utility distributed as a Docker image or a programming language other than Python. The image to launch can be located in any open Docker image registry.
Note
Custom images created in a project are not available to run in a cell.
To start a container, enter the following command in a notebook cell:
#!:docker-run <image name>
If you need to add computing resources, specify a configuration prefix, such as:
#!g1.1:docker-run <image name>
For example, the https://hub.docker.com/_/golang public image provides access to Go utilities. To run the go version
command in this image, run a cell with the following code:
#!:docker-run golang go version
Result:
go version go1.16.6 linux/amd64