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