Deploy Application using Docker with Nginx
Docker Tutorial
https://github.com/Ameen-Alam/CNC-Docker.git Clone the sample app from GitHub.
$ git clone https://github.com/Ameen-Alam/CNC-Docker.git
The clone operation creates a new directory called CNC-Docker . Change directory into CNC-Docker and list its contents.
$ cd CNC-Docker
Available Multiple Image Directories (001-static --to-- 010-mongoDB)
$ cd 001-static
two way to run a container
- The Ops perspective
- The Dev perspective
Start The Ops Perspective
If you are working from a freshly installed Docker host it will have no images and will look like the output above. Getting images onto your Docker host is called βpullingβ. If you are following along with Linux, pull the ameenalam/nodeapp:latest.
To pull an image
docker pull <image_name>:<tag>
$ docker image pull ameenalam/nodeapp:latest
Docker images list
$ docker image ls
Run Container
docker run -d --name <container_name> -p <host_port>:<container_port> <image_name>:<tag>
$ docker container run -d --name=web2 -p=7000:8080 ameenalam/nodeapp:latest
For Test
$ curl http://localhost:7000
Open a web browser and navigate to the DNS name or IP address of the host that you are running the container from and point it to port 7000. You will see the following web page.
Push images to Docker Cloud
Docker Cloud uses Docker Hub as its native registry for storing both public and private repositories. Once you push your images to Docker Hub, they are available in Docker Cloud.
In order to get you started, let us get you a Docker ID.
Docker login
Log in to Docker Cloud using the docker login command.
$ docker login
Tag Image
Tag your image using docker tag.
$ docker tag image_name username/image_name
Push your image to Docker Hub
Push your image to Docker Hub using docker push (making the same replacements as in the previous step).
$ docker push username/image_name
Check that the image you just pushed appears in Docker Cloud. Go to Docker Cloud and navigate to the Repositories tab and confirm that your image appears in this list.
Facebook Profile: https://www.facebook.com/SheikhAmeenAlam