프로그래밍 언어 및 기타/Docker

생활코딩 Docker 이미지 만드는 법 - Dockerfile & build 정리

https://www.youtube.com/watch?v=0kQC19w0gTI 

 

Dockerfile

FROM ubuntu:20.04
RUN apt update && apt install -y python3
WORKDIR /var/www/html
# RUN echo "Hello, <strong>docker</strong>" > index.html
COPY ["index.html", "."]
CMD ["python3", "-u", "-m", "http.server"]

이 Dockerfile 이 있는 위치에서 파일도 만들고 명령어들을 실행하면 된다.

 

 

index.html

Hello, <strong>docker</strong>

 

쳐야하는 명령어들.

docker build -t web-server-build .
docker rm --force web-server
docker run p- 8888:8000 --name web-server web-server-build