Samples Docker labs¶
- Samples Docker labs beginner
- 2) Webapps with Docker (Python + Flask)
- Introduction
- Run a static website in a container : docker run -d dockersamples/static-site
- docker images
- docker run –name static-site -e AUTHOR=”patrick.vergain” -d -P dockersamples/static-site
- docker port static-site
- docker run –name static-site-2 -e AUTHOR=”patrick.vergain” -d -p 8888:80 dockersamples/static-site
- docker stop static-site
- docker rm static-site
- Let’s use a shortcut to remove the second site: docker rm -f static-site-2
- Docker Images
- docker pull ubuntu:16.04
- Create your first image
- Create a Python Flask app that displays random cat pix
- app.py
- requirements.txt
- templates/index.html
- Write a Dockerfile
- Build the image (docker build -t id3pvergain/myfirstapp)
- docker images
- Run your image (docker run -p 8888:5000 –name myfirstapp id3pvergain/myfirstapp)
- Push your image (docker push id3pvergain/myfirstapp)
- docker rm -f myfirstapp
- docker ps
- Dockerfile commands summary
- Next Steps : Deploying an app to a Swarm
- 3.0) Deploying an app to a Swarm