- Introduction to Docker
- Install docker and docker-compose-plugin on server
week4. Add your user todockergroup. - Create docker network
- Set
week4as a name. - Set
bridgeas driver. - Set
172.20.0.0/16as subnet. - Set
172.20.0.1as gateway.
- Set
- Write
Dockerfileon server to build image nginx. It is important to build nginx image not to use already existed.- Use Ubuntu as base image
- As nginx default page image has to return "DevOps Internship" message as nginx's default web page.
- Run newly created image on server as
week4-nginxnamed container with 8080:80 binded port. - Deploy newly created image to remote image registry as
REGISTRY/name-surname:week4-nginx.
- Pull gitlab repository to server
week4and write dockerfile for tictactoe project.- Build and push image to
REGISTRY/name-surname:week4-tictactoe. - Run newly created image as
week4-tictactoenamed container week4-tictactoecontainer toweek4network. EXTRA: Image should be optimized as possible (as less image size as possible).
- Build and push image to
- Work with docker compose folder. You have to write dockerfile for
applicationfolder it is python application runs on port5000. Dockerfile fordatabaseis already provided no need to edit anything there. Declareweek4network as external indocker-compose.yml. database service name:postgresapplication service name:application- Write docker compose file and run it as
week4.- Application started
- Database started
- Service: application
- Should be networks:
default,week4
- Should be networks:
- Service: database
- Should be in networks:
week4
- Should be in networks:
- Bind
applicationto port5000.
- Write docker compose file and run it as
Be carefull with environmental variables.
Default values you can find in application/main.py