This guide is for advanced DSMLP users (both students and instructors) who want to add or modify applications on their working environment using a custom Docker container.
A Docker image is a snapshot of packaged applications, dependencies and the underlying operating system. Users can use the same Docker image anywhere on any machine running the Docker platform while having the same software functionality and behavior. DockerHub is a public container registry you can download ("pull") and upload ("push") Docker images. Just like GitHub hosts git repositories, DockerHub hosts and distributes Docker images. In this guide, we will design a custom Docker image by modifying a Dockerfile, build the image and publish it on DockerHub.
A new GitHub git repo using this as a template. Click "Use this template" at upper-right corner. You can also use an existing repo by adding a Dockerfile at the repo's root level.
A Docker Hub account. Register at https://hub.docker.com/. You will need this for publishing your new image and configuring automated builds.
A new public repo on DockerHub. You can name it whatever you want.
Choose the base container by uncommenting the corresponding line that set the BASE_CONTAINER argument
datascience-notebook base image includes conda and basic python packages for data science (pandas, scipy, matplotlib) from miniconda.scipy-ml image has a wider range of packages including tensorflow, pytorch, including CUDA 10 support, generally used for GPU-accelerated workflows.scipy-ml has more functionality, the build process may take longer and result in a larger image.Use USER root to gain root privileges for installing system packages. This line is already typed out for you.
Install system-level packages using apt-get
htop.Install conda packages
RUN conda install --yes <package1> <package2> to install all required conda packages in one goRUN conda clean -tipy to reduce image sizeInstall pip packages
pip install --no-cache-dir <package> for installing pip packagesLeave the rest of the Dockerfile as is
In this step you will build the image using the Dockerfile you created. Here you have two options:
It is recommended to try both routes for easier debugging and shorter turnaround time on successful builds. If you don't want to install Docker on your local machine, you can always use a $50 DigitalOcean credit from the GitHub Student Developer Pack and launch a Docker Droplet there.
docker build -t test . and hit Enter. Docker will build the image according to the local Dockerfile. The resulting image will be labeled test. If the build fails, take note of the last command Docker ran and start debugging from there. Run the command again to rebuild after the Dockerfile is edited.docker run --rm -it test /bin/bash to enter the image in a container. Test if it has all the functionality you want. Use exit to exit from the container. The container will be automatically deleted.docker tag test <dockerhub-username>/<dockerhub-repo>. And push the image docker push <dockerhub-username>/<dockerhub-repo>.docker run -it test /bin/bash, use CTRL+P-Q to detach from container, find the running container in docker ps and docker commit CONTAINER_ID <dockerhub-username>/<dockerhub-repo> followed by docker push <dockerhub-username>/<dockerhub-repo>.launch-scipy-ml.sh -i <dockerhub-username>/<dockerhub-repo>kubectl logs <pod-name> or contact ETS service desk for help.-n <node-number> at the end of the launch command.CMD ["/bin/bash"] as the last layer (as last line in Dockerfile). You can always launch the notebook again and manually port-forward on dsmlp-login. kubectl port-forward pods/<POD_NAME> <DSMLP_PORT>:8888Content type
Image
Digest
Size
1.9 GB
Last updated
over 5 years ago
docker pull edwin5588/dsc180a-docker