Task-Based on both Docker Sessions of the masterclass
what is docker
Docker is an open-source platform for building, deploying, and managing containerized applications. Learn about containers, how they compare to VMs, and why Docker is so widely adopted and used. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment. Containers simplify the delivery of distributed applications and have become increasingly popular as organizations shift to cloud-native development and hybrid?multi-cloud?environments.
#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:-
1) create a docker-compose file using vim, Edit the Docker-compose file, the first section to define web portion and the second section defines the databse
2) creating the inde.php and edit the file and add credentials for mysql
3) now create Dockerfile using vim, Edit that file put some specific keywords that dictate how to build a specific image.
4) install Docker compose for project
领英推荐
5) change the file mode(action)
6) need to build the container (Docker container)
7) use Docker-compose-up to aggregate the output of each container
8) Docker-compose up -d command for detached mode
#TASK2.2:?Dockerfile
1) Webserver
2) This is coming from Docker ---> Content
3) CentOS?
solution:-
1) create a new directory and get into that after that create an index.html file and create dockerfile which include the specific keyword that dictates how to build a specific image
#html file
2) now strat the docker service and create the docker image inside the Dockerfile
#set the webserver "docker run -dit -p 3000:80"
3) Go to the web browser and check localhost:3000
#Thankyou for seeing my article