Dockerfile 초기 체험

1515 단어
Dockerfile 구축 nginx
       
mkdir -p /nginx

       
cd /nginx

            
vim Dockerfile

 1,         
FROM nginx
 2, 

I'm index.html...

/usr/share/nginx/html/index.html RUN echo "

I'm index.html...

" > /usr/share/nginx/html/index.html nginx taopanfeng . docker build -t nginx:taopanfeng . docker run --name nginx_01 -p 91:80 -d nginx:taopanfeng Windows 192.168.1.3:91 index.html

Dockerfile springboot 프로젝트 구축
  
mkdir -p /app/test
cd /app/test

1,spring       
2,  web   
3, application.properties   server.port=8101
4, Controller       GetMapping("hello")   I'm hello...
5,  maven clear package
6, target  jar    /app/test

vim Dockerfile
###
#   java:8     
FROM java:8
#             /tmp
VOLUME /tmp
#    jar               app.jar
ADD demo-0.0.1-SNAPSHOT.jar /app.jar
#     8101    Docker      8101
EXPOSE 8101
#           java -jar /app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
###

      test    0.0.1    .      
docker build -t test:0.0.1 .

      8101 Linux  8102         test01
docker run --name test01 -p 8102:8101 -d test:0.0.1

  test01           ,     IPAddress      ip
docker inspect test01

Linux---     I'm hello... 
    Linux     ip        jar        
curl 172.17.0.4:8101/hello

Windows---        I'm hello... 
    Windows  Linux ip   
  Windows           Linux ip  docker run  -p       
192.168.1.3:8102/hello

좋은 웹페이지 즐겨찾기