# ---------------------------------------- # Docker Demo Script # ---------------------------------------- # Resources: # https://docker-curriculum.com/ # https://docs.docker.com/engine/reference/commandline/cli/ # https://docs.docker.com/engine/install/ $ docker --version Docker version 29.6.1, build 8900f1d # Check available images $ docker images IMAGE ID DISK USAGE CONTENT SIZE EXTRA # View Dockerfile contents (assuming you have a Dockerfile in the current folder) $ cat Dockerfile FROM python:3.12-slim RUN apt-get update && \ apt-get install -y git make vim dos2unix && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip && \ pip install autopep8 coverage mypy pylint numpy && \ pip list CMD ["bash"] # Build the Docker image # --tag or -t assigns a name (optionally with a tag in 'name:tag' format) # If no tag is given, 'latest' is used $ docker build -t fareszf/python . # Log in to Docker Hub $ docker login # Push the image to Docker Hub $ docker push fareszf/python # Pull the image from Docker Hub $ docker pull fareszf/python # Check available images again $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE fareszf/python latest 21db6f0d7ede 56 seconds ago 440MB # Confirm working directory $ pwd /c/Users/Fares/Documents/demo $ ls Dockerfile # Run container with mounted volume and working directory # -it: interactive terminal # -v : mount host directory to container # -w : set working directory in container # For Mac machines. # $ docker run -it -v /Users/Fares/Documents/demo:/usr/cs373 -w /usr/cs373 fareszf/python # For Windows machines. $ docker run -it -v /c:/Users/Fares/Documents/demo://usr/cs373 -w //usr/cs373 fareszf/python # Inside container root@container:/usr/cs373# ls Dockerfile # Check installed tools root@container:/usr/cs373# which coverage /usr/local/bin/coverage root@container:/usr/cs373# coverage --version Coverage.py, version 7.15.0 with C extension Full documentation is at https://coverage.readthedocs.io/en/7.15.0 root@container:/usr/cs373# which git /usr/bin/git root@container:/usr/cs373# git --version git version 2.47.3 root@container:/usr/cs373# which make /usr/bin/make root@container:/usr/cs373# make --version GNU Make 4.4.1 root@container:/usr/cs373# which pip /usr/local/bin/pip root@container:/usr/cs373# pip --version pip 26.1.2 from /usr/local/lib/python3.12/site-packages/pip (python 3.12) root@container:/usr/cs373# pip list # (Package list output here) root@container:/usr/cs373# which pylint /usr/local/bin/pylint root@container:/usr/cs373# pylint --version pylint 4.0.6 astroid 4.0.4 Python 3.12.13 (main, Jun 24 2026, 02:08:01) [GCC 14.2.0] root@container:/usr/cs373# which python /usr/local/bin/python root@container:/usr/cs373# python --version Python 3.12.13 root@container:/usr/cs373# which vim /usr/bin/vim root@container:/usr/cs373# vim --version VIM - Vi IMproved 9.1 (2024 Jan 02, compiled May 23 2025 00:48:59) # Exit the container root@container:/usr/cs373# exit exit