Docker Installation and commands

ABHISHEK KUMAR
1 min readJul 24, 2019

--

Docker installation

Remove Docker Initially

sudo apt-get remove docker docker-engine docker.io containerd runc

sudo apt update

Install

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
“deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable”
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.iosudo groupadd docker
$ sudo usermod -aG docker $USER
sudo reboot

Dockerfile:
FROM node:8

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci — only=production

# Bundle app source
COPY . .

EXPOSE 8080
CMD [ “node”, “index.js” ]

Docker Commands

docker build -t image_name .
service docker start
docker images
docker ps
docker run -p 8081:8081 image-id
docker login
docker tag image_tag_name path_of_docker:image_name
docker push path_of_image
docker pull path_of_image:image_name
docker run -p 8081:8081 image_tag_name
docker run -p 3000:3000 -it image_path:image_name

https://www.youtube.com/watch?v=KERordttCPM&list=PLw-IdJ8Ov3wKNk0MSwQY9Wt4mrx4MyBaE&index=1

###https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
###https://ropenscilabs.github.io/r-docker-tutorial/04-Dockerhub.html

--

--

ABHISHEK KUMAR
ABHISHEK KUMAR

Written by ABHISHEK KUMAR

DevOps/Cloud | 2x AWS Certified | 1x Terraform Certified | 1x CKAD Certified | Gitlab

No responses yet