This is simple learning project of nginx
Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.
$ docker run --name some-nginx -v /some/content:/usr/share/nginx/html:ro -d nginx
Alternatively, a simple Dockerfile can be used to generate a new image that includes the necessary content (which is a much cleaner solution than the bind mount above):
FROM nginx
COPY static-html-directory /usr/share/nginx/html
Place this file in the same directory as your directory of content ("static-html-directory"), run docker build -t some-content-nginx ., then start your container:
$ docker run --name some-nginx -d some-content-nginx
MongoDB is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemata. MongoDB is developed by MongoDB Inc., and is published under a combination of the Server Side Public License and the Apache License.
First developed by the software company 10gen (now MongoDB Inc.) in October 2007 as a component of a planned platform as a service product, the company shifted to an open source development model in 2009, with 10gen offering commercial support and other services. Since then, MongoDB has been adopted as backend software by a number of major websites and services, including MetLife, Barclays, ADP, UPS, Viacom, and the New York Times, among others. MongoDB is the most popular NoSQL database system.
$ docker run -it --network some-network --rm mongo mongo --host some-mongo test
Example stack.yaml
for mongo:
services:
mongo:
image: mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
- Run 'brew install python'
- then run
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- then run
pip install flask
- Now, create a file called `app.py'
from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "hello world!" if __name__ == "__main__": app.run(host="0.0.0.0") > app.py
- Run
app.py
aspython3 app.py
- Create a file
Dockerfile
in theroot
directory of the project folder. - Build an image simply run command as
docker image build -t python-ngnix .
. - Run command to see the image of the project
docker image ls
- Now, run simply command to see the outcome of the
app.y
usingdocker run -p 5001:5000 -d 2452cf61dd6f
- To stop all Docker containers, simply run the following command in your terminal:
docker kill $(docker ps -q)
- If you don’t just want to stop containers and you’d like to go a step further and remove them
docker rm $(docker ps -a -q)
- To remove all Docker images, run this command
docker rmi $(docker images -q)
Follow me on - Medium | Linkedin | YouTube | StackOverFlow