22 - CONTAINERIZATION Flashcards

1
Q

Why containerization ?

A

Containerization addresses the need for consistency, portability, efficiency, and scalability in software development and deployment. It simplifies the packaging and distribution of applications, making it easier to manage complex systems and adapt to the demands of modern software development practices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

dockerhub setup

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

docker file structure for app, web, db

A

Docker-files
app/Dockerfile
web/Dockerfile
db/Dockerfile
docker-compose/yml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

dockerhub repositories
app, db, web

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

create docker file for app
https://github.com/devopshydclub/vprofile-project

From openjdk:11 as BUILD_IMAGE
RUN apt update && apt install maven -y
RUN git clone repo_url
RUN cd vprofile-project && git checkout docker && mvn install

FROM tomcat:9-jre11
RUN rm -rf /usr/local/tomcat/webapps/*
COPY - -from=BUILD_IMAGE vprofile-project/target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT
EXPOSE 8080
CMD [“Catalina.sh”, “run”]
WORKDIR /usr/local/tomcat
VOLUME /usr/local/tomcat/webapps

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

dockerfile for db

  • FROM mysql:8.0.33
  • LABEL “Project”=”name”
  • LABEL “Author”=”Author name”
  • ENV MYSQL_ROOT_PASSWORD=”vprodbpass”
  • ENV MYSQL_DATABASE=”accounts”
  • ADD db_backup.sql docker-entrypoint-initdb.d/db_backup.sql
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

dockerfile for web server

  • FROM nginx
  • LABEL Project
  • LABEL Author
  • RUN rm -rf /etc/nginx/conf.d/default.conf
  • COPY nginvproapp.conf /etc/nginx/conf.d/vproapp.conf
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

run docker-compose file

version: ‘3.8’
services:
vprodb:
build:
context: ./Docker-files/db
image: vprocontainers/vprofiledb
container_name: vprodb
ports:
- ‘3306:3306’
volumes:
- vprodbdata:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=vprodbpass

vprocache01:
	image: memcached
	ports:
		- '11211: 11211'
																			
vpromq01:
	image: rabbitmq
	ports: 
		- '15672: 15672'
	environment:
		- RABBITMQ_DEFAULT_USER=guest
		- RABBITMQ_DEFAULT_PASS=guest

vproapp:
	build:
		context: ./Docker-files/app
		image: vprocontainers/vprofileapp
		container_name: vproapp
	ports:
		– '8080:8080'
	volumes:
		-  vproappdata: /usr/local/tomcat/webapps    

vproweb:
	build:
		context: ./Docker-files/web
		image: vprocontainers/vprofileweb
		container_name: vproweb
	ports:
		– '80:80'
	volumes:
		-  vproappdata: /usr/local/tomcat/webapps    

volumes:
vprodbdata: {}
vproappdata: {}

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

build all images

A

docker compose build

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

start all containers

A

docker compose up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

upload images to dockerhub

A

docker login
docker push

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

stop containers

A

docker compose down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

remove all images

A

docker compose prune

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

containerize microservice project
https://github.com/devopshydclub/emartapp

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly