파일 구조
/docker/nginx_ubuntu/Dockerfile
/docker/nginx_ubuntu/entrypoint.sh
/docker/docker-compose.yml
/docker/nginx_ubuntu/Dockerfile
FROM ubuntu:18.04
RUN apt update -y
RUN apt install vim -y
RUN apt install net-tools -y
RUN apt install iputils-ping -y
RUN apt install nginx -y
WORKDIR /
COPY ./nginx_ubuntu/entrypoint.sh /
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
/docker/nginx_ubuntu/entrypoint.sh
#!/bin/bash
sleep 1
service nginx start
sleep 1
/bin/bash
/docker/docker-compose.yml
version: '2'
services:
nginx_ubuntu:
hostname: nginx_ubuntu
container_name: nginx_ubuntu
build:
context: .
dockerfile: ./nginx_ubuntu/Dockerfile
stdin_open: true
tty: true
ports:
- 8080:80
docker-compose.yml 이 있는 위치로 이동
ls
pwd
컨테이너 만들기
docker-compose up -d
로컬의 웹브라우저에서
local:8080으로 들어가보기