TASK BASED ON DOCKER
#TASK2.1:?The compose should deploy two services (web and DB), and each service should deploy a container as per details below:
For web service: — ->> php:rc-apache
a. Container name must be php_web.
b. Use image php with any apache tag. Check here for more details?https://hub.docker.com/_/php?tab=tags.
c. Map php_web container’s port 80 with host port 6000 d. Map php_web container’s /var/www/html volume with host volume /var/www/html.
For DB service:
a. Container name must be mysql_web.
b. Use image mariadb with any tag (preferably latest). Check here for more details?https://hub.docker.com/_/mariadb?tab=tags.
c. Map mysql_web container’s port 3306 with host port 3306
d. Map mysql_web container’s /var/lib/mysql volume with host volume /var/lib/mysql.
e. Set MYSQL_DATABASE=database_web and use any custom user ( except root ) with some complex password for DB connections. After running docker-compose up you can access the app with curl command curl <server-ip or hostname>:6000/
SOLUTION:
docker-compose.yml:
index.php:
Dockerfile:
Finally you will get the output:?“Successfuly Connected to MYSQL”
#TASK2.2:?Dockerfile
1) Webserver
2) This is coming from Docker — -> Content
3) CentOS
SOLUTION:
Run localhost:3000 in your browser: