Docker Basic

“Docker is a tool that can package an application and its dependencies in a virtual container that can run on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premises, public cloud, private cloud, bare metal, etc.” Linux.com. Retrieved August 9, 2013.

Installation

  1. Install Docker in CentOS
1
2
3
4
5
6
7
8
9
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

sudo yum install docker-ce docker-ce-cli containerd.io
  1. Post Install
1
2
3
4
5
6
7
8
9
10
sudo systemctl enable docker
sudo systemctl start docker

sudo usermod -aG docker $USER

docker ps
docker run --rm hello-world

sudo systemctl stop firewalld
sudo systemctl start firewalld

Basic command

build.sh
1
docker build -t simple-web-server .
deploy.sh
1
2
3
docker run --name my-web-server -d -p 3000:3000 simple-web-server
docker logs -f my-web-server
docker rm -f my-web-server

Ref

Docker: https://www.docker.com/