Custom containers feature lets you pull your own image from Docker Hub. This article will help you prepare a custom Docker container to use with Gradient, show you how to bring that Container into Gradient, and create a notebook with your custom container. We recommend using Docker to get the container image from your system to Gradient.
Preparing a Custom Container
1. To get started, you’ll need:
- An Ubuntu computer with DockerCE, NVIDIA-docker, and NVIDIA Drivers installed (if you don’t have a Linux machine, use a Paperspace Linux VM!).
- From that machine, you'll need to be logged into your Docker Hub account
docker login -u <username> -p <password>
2. Add a Docker file to a working directory on your system
You can make your own file (see Requirements below) or use one like this example: https://github.com/Paperspace/tensorflow-python
3. In the same directory:
docker build -t <name of image>
for the example file above, you would enter:
docker build -t test-container
- Verify with docker images. It should look something like this:
- Tag the image so that is can be added to a repo with the image id, your Docker Hub username, and a name for the image :
docker tag <image id> <dockerhub username>/test-container:latest
4. Push the image to Docker Hub with your username:
docker push <username>/test-container:latest
Requirements of Custom Notebooks
- Jupyter and all of Jupyter dependencies must be installed:
conda install -c conda-forge jupyterlab
If you don't specify a user, your container user will be 'root'
Bringing your Custom Container to Paperspace
After you've pushed your custom container to Docker or you found a public container that is already there, it's time to pull it into Paperspace!
Notebooks Page. Select Notebooks from your left-hand navigation menu. Click the Custom Containers tab in the Base Containers section.
- Container Name = image name ('test-container' from our example above)
- Username = your Docker Hub username
- Password = your Docker Hub password, can be left blank for public images
- Default Entrypoint = must be Jupyter compatible, defaults to 'jupyter notebook' if left blank
- Container user = optional user, defaults to 'root' if left blank
Follow the rest of the steps to create your Notebook by selecting your machine type, naming your notebook, and clicking Create.
If your container is hosted in a password protected repository (you have set your Docker Image to 'Private'), you will need to enter your Docker Hub password. Otherwise, leave this field blank. This is not your Paperspace username and password.
Privacy settings for a given container might look something like this in Docker Hub:
if a Notebook image is private and the password is missing or invalid, the Notebook won't run :(