Difference between revisions of "Docker Notes"
Line 31: | Line 31: | ||
to run as a background process | to run as a background process | ||
<source> | <source> | ||
− | >docker run -d -p | + | >docker run -d -p 84:80 webapp-oasis:latest #docker [deamon(background process)] [port] [hostport]:[containerport] [docker-image]:version |
+ | </source> | ||
+ | |||
+ | to test go to container ip address, and test: | ||
+ | <source> | ||
+ | http://192.168.1.153:84/webapp.html | ||
</source> | </source> |
Revision as of 13:34, 9 October 2018
Building && Running APP
> mkdir nginx-webapp
> cd nginx-webapp
> vi webapp.html
> <html><body>...first app..</body></html>
> vi nginx.conf #server conf file..
server{
root /www;
}
> vi Dockerfile # dockerfile is blueprint of our image
FROM nginx:latest #or version
ADD webapp.html /www/
ADD nginx.conf /etc/nginx/conf.d/default.conf
#EXPOSE 80
#EXPOSE 443
#CMD nginx -g "deamon off;" #to start nginx server
to start & test
>docker build . -t webapp-oasis:latest
>docker run webapp-oasis
>docker ps #to see docker running images..
to run as a background process
>docker run -d -p 84:80 webapp-oasis:latest #docker [deamon(background process)] [port] [hostport]:[containerport] [docker-image]:version
to test go to container ip address, and test:
http://192.168.1.153:84/webapp.html