Docker Installation and commands

Docker installation

Remove Docker Initially

sudo apt-get remove docker docker-engine containerd runc

sudo apt update


sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
curl -fsSL | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
“deb [arch=amd64] \
$(lsb_release -cs) \
sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.iosudo groupadd docker
$ sudo usermod -aG docker $USER
sudo reboot

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 . .

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





Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

Using MSBuild/VSBuild to prepare Docker image and deploy it to Azure App Service

Bind Mounts & Volumes in Docker

Bind Mounts & Volumes in Docker

How To Deploy Nuxt Js App On Docker Swarm Cluster

Kubernetes v1.22.5 - Troubleshooting with Docker Desktop 4.7.1