목차
Dockerfile 작성
Dockerfile
[root@lab-centos-on-docker-vm workspace]# cat Dockerfile FROM tomcat:9-jre8-alpine COPY index.html /usr/local/tomcat/webapps/ROOT CMD ["catalina.sh", "run"]
index.html
[root@lab-centos-on-docker-vm workspace]# cat index.html hello 2019-12-05
Build & Tag 생성
docker build -t sooabia/sanse-tomcat9:2 .
[root@lab-centos-on-docker-vm workspace]# docker build -t sooabia/sanse-tomcat9:2 . Sending build context to Docker daemon 3.072kB Step 1/3 : FROM tomcat:9-jre8-alpine ---> 387f9d021d3a Step 2/3 : COPY index.html /usr/local/tomcat/webapps/ROOT ---> efd6f75af6db Step 3/3 : CMD ["catalina.sh", "run"] ---> Running in f5add9960acd Removing intermediate container f5add9960acd ---> 4f2581f1877d Successfully built 4f2581f1877d Successfully tagged sanse-tomcat9:2
새로만든 Docker images 실행해보기
docker run -d -p 80:8080 sooabia/sanse-tomcat9:2
[root@lab-centos-on-docker-vm workspace]# docker run -d -p 80:8080 sooabia/sanse-tomcat9:2 9859a78bb9bebe5243b8639fb11a45d1e517376ca20293d1f35e7296d9dc9b2e