Hot-reloading GPU-enabled containers for seamless testing and development
Dockerfile
. They then start an instance with the specified gpu type and start a container. The container runs a hot-reloading server that watches for changes in your project files. When a change is detected, the server rebuilds the container and restarts it with the updated code.
Dockerfile
and your project files in a directory. You can take the below example as a reference where we test a simple python server which returns the gpu type of the container.
Dockerfile
. For this example, we will create a simple FastAPI server that returns the gpu type of the container and a Dockerfile
to define it’s environment. You can create a .dockerignore
file to exclude unnecessary files from the container.
80
as Tensorkube forwards this port by default. The --port
argument specifies
the port on which the dev container will be accessible from your local machine and cannot be used to change the port in the Dockerfile.--cloud aws
: The cloud provider where the dev container will be started. Currently, only aws
and lambda
are supported.--gpu-type A100
: The type of GPU to use for the dev container. You can choose from H100
,A100
, V100
, L40S
, A10G
, L4
, T4
and V100
. Specify None
if you don’t need a GPU.--port 8080
: The port on which you can access the devcontainer from your local machine.8080
is the default port.port
(8080 in this case)curl http://localhost:8080/gpus
.http://localhost:<port>
. Try making changes to your main.py
file and see the changes reflected in real-time in the running container.
Ctrl+C
, the dev container will be stopped but the instance will continue to run. To avoid incurring charges, make sure to stop or delete the dev container when you’re done testing.