Docker Project
In this project, I created containers using httpd and nginx images using command
~ docker pull httpd
~ docker run --name httpdproject httpd -d
Then I first stop and then remove this container
* docker stop httpdproject
* docker rm httpdproject
Then I mount my website content on my container using these commands
~ docker run --name mywebproject -p 8080:80 -v $(pwd)/web:/usr/local/apache2/htdocs:ro -d httpd
~ docker ps
- We can check our website will be running on 8080 port which it's redirecting to 80 port of container
Same Process, we will do with nginx
~ docker run --name nginxproject -p 8082:80 -v $(pwd)/web:/usr/share/nginx/html:ro -d nginx
Now, we can see our site will be working on 8082 port.
Dictionary
ps command to check running containers
images command to see available images
-p this flag with run use for port redirecting
-v is used to mount volume on the container
--name flag with run is used to name our container
-d flag means run container in detached mode. It means that it should be run in the background
Top comments (0)