You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »


목차


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

Docker Hub에 올리기

  • Docker hub로그인
[root@lab-centos-on-docker-vm workspace]# docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: sooabia
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

  • Docker hub에 업로드
[root@lab-centos-on-docker-vm workspace]# docker push sooabia/sanse-tomcat9:2
The push refers to repository [docker.io/sooabia/sanse-tomcat9]
66e6933100ba: Pushed
b7d850202de0: Mounted from library/tomcat
d1d0b1719b96: Mounted from library/tomcat
48988bb7b861: Mounted from library/tomcat
edd61588d126: Mounted from library/tomcat
9b9b7f3d56a0: Mounted from sooabia/reactor-demo
f1b5933fe4b5: Mounted from sooabia/reactor-demo
2: digest: sha256:7c98ffb33f01e4a67d1df8eb9dfa10792b61949c5636069eb504a06b14af110c size: 1781


  • No labels