Introduction to the Dockerfile Part II

Intoduction to the Dockerfile for beginner

source image : deploybot.com

Create Dockerfile

vim Dockerfile

Dockerfile content:

# Use an official Python runtime as a parent image
FROM python:2.7-slim

Create requirements.txt file

Flask

Create app.py file

from flask import Flask
from redis import Redis, RedisError
import os
import socket

Build image from Dockerfile

sudo docker build -t friendlyhello .

See image friendlyhello

sudo docker image ls

Run image friendlyhello

sudo docker run -d -p 4000:80 friendlyhello

See container :

sudo docker container ls

Test app using curl

curl http://localhost:4000

Test app

This is my little notes based my experiment and my learning. Keep learning and keep calm.

This is my little notes based my experiment and my learning. Keep learning and keep calm.