How to Install Docker on VM Machine | Use Docker pull to download Docker Image | how to run Container
Create VM Instance like Docker.
Install Docker:
Run below commands:
Official site for Steps: https://docs.docker.com/engine/install/ubuntu/
After install check version:
docker --version
Post installation steps:
Add your current user to docker group to allow access on
docker commands:
sudo usermod -a -G docker $USER
Logout from terminal and login to the user again:
exit
Use docker pull to download docker images on this server:
docker pull nginx
Use docker run to run nginx container using this image. Use
below parameters for the container:
- i.
Name: mynginx
- ii.
Host port: 80
- iii.
Container port: 80
- iv.
Should run in detach mode
command:
docker run -ti -d --name mynginx -p 80:80 nginx
Login to mynginx container and check the nginx process
running or not. Ideally it should be running:
docker exec -ti mynginx bash
Install procps to run ps command inside container
Command:
apt-get update && apt-get install procps
Check if nginx is accessible on http://<Server_Pubilc_IP>:80 and
you see below page:
0 Comments
If you have any queries, please let me know. Thanks.