In the previous getting started AI in healthcare with MONAI post I mentioned that you can use MONAI Docker images for your work. Now, In this post I will mention in detail using MONAI Docker images for our AI applications in healthcare.
Before starting to use MONAI Docker please be sure that you have installed required softwares like NVIDIA GPU Driver, Docker 19.03+, NVIDIA Docker also called NVIDIA Container Toolkit properly. If you didn't do it yet you can read my how to setup your AI workstation post. Then you can continue to this post.
MONAI Docker Image Usage
Download MONAI Docker
If you installed and validated the required softwares we can continue. Let’s pull the container image. This process will take some time because container image is more than 6GB in size.
docker pull projectmonai/monai:0.9.1
Create MONAI Docker Container
After the pulling we will create a container from the image which we downloaded. The command below creates a container from image and gives name to it ‘monai-core’ and gives permissons to use all GPU resources. Also we can access our container with terminal connection.
docker run --name monai-core --gpus all --ti --ipc=host projectmonai/monai:0.9.1
Connect Container Terminal
We created our container and it includes almost all of our needs to work AI in healthcare applications. Now, will open a new terminal and connect our container’s terminal.
docker exec -it monai-core sh
Start Jupyter Lab
Let’s start Jupyter Lab server to work with Jupyter Notebooks and following tutorials prepared with it.
jupyter lab --ip 0.0.0.0 --allow-root
After running this command the Jupyter server will up and prompt our token. After that lab will be accessible through our containers local IP address. Open your browser and go to http://172.17.0.1:8888/lab address. Ta da! You should see Jupyter login page. Login with your token which prompted in terminal after server running.
MONAI has official Docker images and you can use them in your projects. After creating container you can work with Jupyter notebooks easily.
If you want to go further with working with Docker containers you can read how to use TensorFlow and PyTorch Docker images post.