DP-100
1 TopicContainerization and Machine Learning Service
One of my favorite open source tools is Docker. It just makes sense with a lot of the work that I do whether it's executing CLI commandsso I can test experimental features without having to re-install CLI each and every time and then enable those commands. Or, if it's working through labs in Jupyter notebooks where I can build and maintain an environment in which I can run experiments against Azure Machine Learning Services (MLS) by simply changing the confi.json file in my root folder. So how's all this work? Well, let me show you. First, let's start out by connecting to a base image that I've built for the labs using vscode: I can go into the details of building that image at a later date, but at this time, I just want to share some of the flexibility of the image itself. Here's the code that I run. docker run -it -p 10000:8888 thejamesherring/labs:latest this will give me an output that looks like the following: Set username to: jovyan usermod: no changes Granting jovyan sudo access and appending /opt/conda/bin to sudo PATH Executing the command: jupyter lab [I 14:31:37.465 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab [I 14:31:37.466 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab [I 14:31:37.468 LabApp] Serving notebooks from local directory: /home/jovyan [I 14:31:37.468 LabApp] The Jupyter Notebook is running at: [I 14:31:37.468 LabApp] http://a30c0b11acd3:8888/?token=dc3db6e906dcb0d403bad05640cf492981105fb81ba2eb25 [I 14:31:37.468 LabApp] or http://127.0.0.1:8888/?token=dc3db6e906dcb0d403bad05640cf492981105fb81ba2eb25 [I 14:31:37.468 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 14:31:37.471 LabApp] To access the notebook, open this file in a browser: file:///home/jovyan/.local/share/jupyter/runtime/nbserver-18-open.html Or copy and paste one of these URLs: http://a30c0b11acd3:8888/?token=dc3db6e906dcb0d403bad05640cf492981105fb81ba2eb25 or http://127.0.0.1:8888/?token=dc3db6e906dcb0d403bad05640cf492981105fb81ba2eb25 you'll notice that I re-routed the port 8888 to port 10000 so I'll need to use that when connecting to the jupyter environment along with the ?token= line. so when I connect it will look something like this: http://localhost:10000/?token=dc3db6e906dcb0d403bad05640cf492981105fb81ba2eb25 Which gives me access to my notebooks, now there are a few things I have to be mindful of: am I connected to the correct MLS Environment? are my lab files updated? To configure the first one, I simply go to the root path of my jupyter lab and modify the config.json file that's located there. subscription_id:"<your azure subscription>" resource_group:"<your resource group>" workspace_name:"<your MLS Workspace name>" after completing this task then I can simply open a terminal navigate to the path of my lab and instruction files and issue a git pull which will ensure I have the latest files. All done, I'm able to start writing experiments against my Azure compute targets from a local containerized docker image from wherever I happen to be. I hope you found this information useful and are able to expand upon and share your learnings with other. Best, James HSolved806Views0likes1Comment