Docker image creation for keras
Creating a docker image to execute python (.py) file . For CNN model using Keras.
Here using Dockerfile to create docker image.
So brief about Docker and Dockerfile :
Docker: Docker is operating-system-level virtualization mainly intended for developers and sysadmins. Docker makes it easier to create and deploy applications in an isolated environment.
A Dockerfile is a script that contains collections of commands and instructions that will be automatically executed in sequence in the docker environment for building a new docker image.
Pre-requisites:
Docker is installed on system
( Example : Here I have installed docker on ubuntu system )
For installation ref link — https://docs.docker.com/engine/install/ubuntu/
Steps to create docker image:
1.Create Dockerfile using editor of your choice
e.g.
mkdir ws
cd /ws
gedit Dockerfile
For Dockerfile please refer https://github.com/MadhuriKonnur/ML-Devops/blob/master/Dockerfile
2.Build or run created image
#docker build . -t <image name>
From this <image name> we can create n no.of images
3. Lauch o.s from created image # docker run -it --name <give name> <image name>
Now o.s is ready to perform all deployment or any other specific activities in this isolated environment easily.
Pushing image to dockerhub
1.Login with your docker hub id (https://hub.docker.com/)
2.Create a repo
3.Login to local terminal
4.Navigate to docker file location
5.Run this command to connect to your dockerhub account
#docker login — username= <your dockerhub name>
enter the password
6.To list all the local docker images
# docker images
7.Identify the image name and image id which you want push to docker hub
# docker tag /:
8.Now push your image to repo by running
# docker push /
9.Upload will take some time based on size of image and bandwidth of internet
Feel free to download same image from -https://hub.docker.com/repository/docker/madhurikonnur/cnn_keras