728x90
docker pull httpd
httpd 이미지를 다운받는다. httpd는 아파치 HTTP Server 공식 이미지이다.
실습을 위해 프로젝트 폴더를 생성한다. 파일 구성은 다음과 같다.
<!DOCTYPE html>
<html>
<body>
<div>
Apache Web Server + Tomcat Web Application Server
</div>
</body>
</html>
다음과 같이 index.html 파일을 구성한다.
FROM httpd
COPY ./public-html/ /usr/local/apache2/htdocs
Dockerfile을 다음과 같이 생성한다.
docker build -t myapache .
Terminal을 통해 Dockerfile 경로에서 다음과 같이 입력해 myapache 이미지를 만든다.
docker run -d --name apache -p 8009:80 myapache
방금 만든 myapahce 이미지를 통해 apahce 컨테이너를 실행시킨다.
localhost:8009에 접속해 제대로 출력되는지 확인한다.
참고
Httpd - Official Image | Docker Hub
Quick reference Supported tags and respective Dockerfile links 2.4.51, 2.4, 2, latest, 2.4.51-bullseye, 2.4-bullseye, 2-bullseye, bullseye 2.4.51-alpine, 2.4-alpine, 2-alpine, alpine, 2.4.51-alpine3.14, 2.4-alpine3.14, 2-alpine3.14, alpine3.14 Quick refere
hub.docker.com
728x90
'Infra > Docker' 카테고리의 다른 글
[Docker] CentOS 깃 서버(Git Server) 컨테이너 구축하기 (0) | 2021.11.22 |
---|---|
[Docker] Apache - Tomcat(SpringBoot) 연동하기 (mod_jk) (0) | 2021.11.19 |
[Docker] Docker Compose 사용해 web, db 컨테이너 연결하기 (springboot, mariadb) (2-tier 구조) (0) | 2021.11.17 |
[Docker] Docker Compose 사용하기 (0) | 2021.11.17 |
[Docker] Docker Network 사용하기 (0) | 2021.11.17 |