41. Docker Compose Example

Published: 19 July 2022
on channel: iMustLearn
47
0

Example 1:
-------------
mkdir compose_app1
cd compose_app1
vi docker-compose.yml
version: "3"
services:
web_nginx:
image: nginx
ports:
"80:80"
busybox_untility:
image: radial/busyboxplus:curl
command: /bin/sh -c "while true; do sleep 10; done"

docker-compose up -d
docker-compose stop
docker-compose start

Example 2:
---------------
vi docker-compose.yml
version: "3"
services:
nginx_custom:
build:
context: .
dockerfile: customnginx.dockerfile
image: mynginx
ports:
"8080:80"
db:
image: mariadb
environment:
MYSQL_ROOT_PASSWORD: test123
volumes:
.:/var/lib/mysql

vi customnginx.dockerfile
FROM ubuntu
LABEL description = "My image for nginx Web Server"
LABEL version = "V1.0"
RUN apt-get update -y && \
apt-get install curl -y && \
apt-get install nginx -y
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

docker-compose up
docker image ls


Watch video 41. Docker Compose Example online without registration, duration hours minute second in high quality. This video was added by user iMustLearn 19 July 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 47 once and liked it 0 people.