Docker Registry :

Before creating the Dockerfile perform all the necessary task manually. Once we execute all the manual steps to create the image then we can write the Dockerfile with the format.

For Example: In the below code I am just creating a my-app image for simple workflow.


	
#  Manual Step by step : 

	# Runs the container and connect us to write the step :
	docker run -it ubuntu bash
	
	# Update Package Index and Install Python :
	apt-get update
	apt-get insall python-pip
	apt-get install -y python
	
	# Install other dependencies :
	pip install flask
	
	# create a python file and paste the source code:
	cat > /opt/app.py
	
	# Start Web Server:
	cd /opt/
	FLASK_APP=app.py flask run --host=0.0.0.0

		
	
#  Create a docker file : 

	# create a directory :
	mkdir my-app
	cd my-app
	
	# create a dockfile :
	cat > Dockerfile
	
	FROM ubuntu
	RUN apt-get update
	RUN apt-get install -y python
	RUN pip install flask
	
	COPY app.py /opt/app.py
	
	ENTRYPOINT FLASK_APP=app.py flask run --host=0.0.0.0
		

create app.py file and paste the application source code there.

	
# # build the docker file : 

	docker build . -t my-app
	
	# validate the created image file :
	docker images
	
	# run the created image file :
	docker run my-app
		

Push the created image to docker hub

We can only push to the repository of our account in docker. For that we need to build the image and tag it to the account-name with -t option.

To push the image to the repository we need to login to docker hub account.

	
# # Push the image to docker hub : 
	
	docker build . -t account-name/image-name 
	docker login
	docker push my-app