version: "3"
networks:
ibm:
driver: bridge
oracle:
driver: bridge
services:
web:
image: nginx
container_name: my-nginx
networks:
- ibm
ports:
- 80
database:
networks:
- oracle
image: redis
container_name: my-db
Next run the docker compose command
docker-compose -f example3-docker-compose.yaml up -d
docker-compose -f example3-docker-compose.yaml down
Let us do another example with volumes
version: '3.8'
services:
wordpress:
image: wordpress
restart: always
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: exampleuser
WORDPRESS_DB_PASSWORD: examplepass
WORDPRESS_DB_NAME: exampledb
volumes:
- wordpress:/var/www/html
db:
image: mysql:5.7
volumes:
- mysqldb:/var/lib/mysql
volumes:
wordpress:
mysqldb:
docker-compose -f example8900-dc.yaml up -d
docker ps
ls /var/lib/docker/volumes/root_wordpress/
ls /var/lib/docker/volumes/root_wordpress/_data
docker exec -it d396d243a4ba bash
Next type env
Variables, which we have created , we will be able to see
Similar you can check for other container
Run that container by using docker exec command
Now, Login into AWS Cloud and add the port Numbers
Next step, go back and copy the public IP Address
and browse that by using public ipaddress:8080
Select the language of your choice
Give the site url . Enter the details and click on Install WordPress
Next step, you should be able to login with your site url
No comments:
Post a Comment
Thank you for visiting my blog