강의 출처 : 동빈나님 유튜브 강의 링크
도커(Docker) 활용 및 배포 자동화 실전 초급 ④ 도커(Docker) 이미지로 Apache 및 PHP 개발환경 구축하기
docker ps -a
docker rm -f `docker ps -a`
FROM ubuntu:18.04
MAINTAINER sumin kim <tn841@naver.com>
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y apapche2
RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:ondrej/php
RUN apt-get update
RUN apt-get install -y php5.6
EXPOST 80
CMS ['apachectl", "-D", "FROEGROUND"]
docker run -p 80:80 -v /home/ec2-user/example/html:/var/www/html example
# -p <host port>:<container port>
80 포트로 실행된 example container를 확인 해보았다.
그러나 php5.6은 설치가 잘못 된 것 같다. index.php 파일을 제대로 출력하지 못하고 있음.
원인 파악이 필요..
docker run -p 81:80 -v /home/ec2-user/example/html:/var/www/html example
동일한 image를 81번 포트를 열어 새로운 container를 띄울 수 있다.