Getting Started with Docker

Install docker

Enabling and start!!
systemctl status docker
systemctl enable docker
systemctl start docker


Create  docker file 

name : Dockerfile

Create a sample file index.html in the same folder.

Create a file name Dockerfile and have below content in it and save the file.

FROM centos
MAINTAINER kishore@test.com

ENV JAVA_VERSION 8u31
ENV BUILD_VERSION b13
RUN yum -y install httpd.x86_64
COPY index.html  /var/www/html/index.html




Build a docker file :
docker build -t samplek .

List of docker images

docker images

docker ps

Run a docker instance : 
docker run -d -i -t samplek /bin/bash

docker ps
Connect to docker instance
docker exec -i -t 1a5c9f21825d /bin/bash

control +D to come out of docker

stop docker instance
docker container stop <docker instance name>


No comments:

Post a Comment