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:

No alt text provided for this image

docker-compose.yml:

No alt text provided for this image

index.php:

No alt text provided for this image

Dockerfile:

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

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:

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

Run localhost:3000 in your browser:

No alt text provided for this image


要查看或添加评论,请登录

Deepali Bhargava的更多文章

  • Task Based on Linux Session-MASTERCLASS

    Task Based on Linux Session-MASTERCLASS

    Q.1 Create a file via touch and update that file and also verify the timestamp and output will be redirected to another…

  • BASICS OF GITHUB AND GIT COMMANDS

    BASICS OF GITHUB AND GIT COMMANDS

    1. What is the difference between pushing and pulling? Pushing: The git push command is used to upload local repository…

  • Regex Assignment Day-3

    Regex Assignment Day-3

    Q.1 Create a folder /dummy/newfolder using the single command inside the Desktop - assume both the folders are not…

社区洞察

其他会员也浏览了