Summer 2021 — Task 1
Task Description
- Pull the Docker container image of CentOS image from Docker Hub and create a new container
- Install the Python software on the top of docker container
- In Container you need to copy/create machine learning model which you have created in Jupyter notebook.
PRE-REQUITIES: Installation of docker…
👉 TASK STARTS…
STEP:1: PULL CENTOS IMAGE…
SYNTAX: docker pull <image_name>:<version>HERE,
docker pull centos:latest
STEP:2: CREATE A NEW CONTAINER…
SYNTAX: docker run -it --name <container_name> <image_name>HERE,
docker run -it --name salaryprediction_ml centos
STEP:3: INSTALL PYTHON SOFTWARE ON TOP OF CONTAINER…
SYNTAX: yum install python3
STEP:4: CREATE ML MODEL IN JUPYTER NOTEBOOK…
STEP:5: COPY DATASET USING WINSCP AND CREATE A MODEL ON TOP OF CONTAINER…
DOWNLOAD : https://winscp.net/eng/download.php
| Now, drag and drop the file…
| Then, copy this file to docker container…
COMMAND: docker cp <source_file_path> <container_name>:/<destination_path>HERE,
docker cp SalaryData.csv salaryprediction_ml:/task1-ml
| Now, start and attach the container…
To start,
CMD: docker start <container_name>
i.e., docker start salaryprediction_mlTo attach,
CMD: docker attach <container_name>
i.e., docker attach salaryprediction_ml
| Now, Install pandas, numpy, sklearn…
CMD: pip3 install pandas numpy sklearn| NOTE: pip3 is used to install python libraries
| Now, create a file to train a model…
To create a file:
CMD: vi <file_name>To read file:
CMD: cat <file_name>Run a python code:
CMD: python3 <file_name> | NOTE: filename with extension '.py'
| Now, create a file for trained model…
|| This way, we obtained our desired output!!! ||