www.free-css.com에서 무료 template을 받아 container 형태로 배포하고자 한다. 외부 port는 7878로 하여 배포하되, Dockerfile에 무료 template을 복사하는 내용이 포함되어야 한다.

해당 image를 template:1.0이라는 <repository>:<tag>로 생성해 Docker hub의 계정에 push하고, 해당 custom image를 download해 container를 생성하라.

  1. root@ubuntu:/test/docker# wget <https://www.free-css.com/assets/files/free-css-templates/download/page284/pet-shop.zip>

    멍멍이 템플릿 다운

  2. root@ubuntu:/test/docker# unzip pet-shop.zip

  3. root@ubuntu:/test/docker# vi Dockerfile

    FROM nginx:latest
    
    COPY ./pet-shop-website-template/ /usr/share/nginx/html/
    WORKDIR /usr/share/nginx/html
    
  4. root@ubuntu:/test/docker# docker build -t template:1.0 .

  5. root@ubuntu:/test/docker# docker run -dp 7878:80 --name template_test template:1.0

  6. root@ubuntu:/test/docker# docker tag template:1.0 beyondthemist/template:1.0

  7. root@ubuntu:/test/docker# docker image push beyondthemist/template:1.0

    root@ubuntu:/test/docker# docker image push beyondthemist/template:1.0
    The push refers to repository [docker.io/beyondthemist/template]
    e505d42ef321: Pushed 
    6cffb086835a: Mounted from library/nginx 
    e2d75d87993c: Mounted from library/nginx 
    5a5bafd53f76: Mounted from library/nginx 
    f86e88a471f4: Mounted from library/nginx 
    f7ed3797e296: Mounted from library/nginx 
    ec4a38999118: Mounted from library/nginx 
    1.0: digest: sha256:e892d124d3c4ccc6f64a32c41e96d965fbc21f677f59d86a3c1897d8183d7dc7 size: 1781
    

    Untitled

    예아 베이베

  8. root@ubuntu:/test/docker# docker pull beyondthemist/template:1.0

    root@ubuntu:/test/docker# docker pull beyondthemist/template:1.0
    1.0: Pulling from beyondthemist/template
    Digest: sha256:e892d124d3c4ccc6f64a32c41e96d965fbc21f677f59d86a3c1897d8183d7dc7
    Status: Image is up to date for beyondthemist/template:1.0
    docker.io/beyondthemist/template:1.0
    
  9. root@ubuntu:/test/docker# docker run --name template_pulled -p 7979:80 -d template:1.0

    root@ubuntu:/test/docker# docker run --name template_test -p 7878:80 -d template:1.0
    659fd68439f792e2410f567a456482fcd9f46294f5138ba68aaf3858b421a605
    
  10. root@ubuntu:/test/docker# docker ps -a

    root@ubuntu:/test/docker# docker ps -a
    CONTAINER ID   IMAGE          COMMAND                  CREATED             STATUS             PORTS                                   NAMES
    a7d007f3d6ed   template:1.0   "/docker-entrypoint.…"   23 seconds ago      Up 22 seconds      0.0.0.0:7979->80/tcp, :::7979->80/tcp   template_pulled
    860ff59f325d   template:1.0   "/docker-entrypoint.…"   4 minutes ago       Up 4 minutes       0.0.0.0:7878->80/tcp, :::7878->80/tcp   template_test
    7d04b3d9dba9   my_nginx:1.1   "/docker-entrypoint.…"   About an hour ago   Up About an hour   0.0.0.0:999->80/tcp, :::999->80/tcp     my_nginx
    81a7d12bdb63   httpd          "httpd-foreground"       3 hours ago         Up 3 hours         0.0.0.0:888->80/tcp, :::888->80/tcp     kakao
    6871579faf08   nginx          "/docker-entrypoint.…"   4 hours ago         Up 4 hours         0.0.0.0:777->80/tcp, :::777->80/tcp     test
    

    이 상태에서는 211.183.3.100:7878, 211.183.3.100:7878모두 pet shop이 떠야 한다.

    Untitled

    Untitled

    예아 베이베