Git Product home page Git Product logo

dockerexample's Introduction

Docker

๋ฐ˜ ๊ฐ€์ƒํ™”๋ณด๋‹ค ์ข€ ๋” ๊ฒฝ๋Ÿ‰ํ™”๋œ ๋ฐฉ์‹์œผ๋กœ, docker์ด๋ฏธ์ง€์— ์„œ๋ฒ„ ์šด์˜์„ ์œ„ํ•œ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋งŒ ๊ฒฉ๋ฆฌํ•ด์„œ ์„ค์น˜ ๊ฐ€๋Šฅ. OS ์ž์›์€ ๊ณต์œ 

  • ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€ : ์œ ์ €๋žœ๋“œ๋งŒ ์„ค์น˜๋œ ํŒŒ์ผ
  • Docker ์ด๋ฏธ์ง€ : ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€์— ํ•„์š”ํ•œ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ, ์†Œ์Šค๋ฅผ ์„ค์น˜ํ•œ ๋’ค ํŒŒ์ผ์„ ํ•˜๋‚˜๋กœ ๋งŒ๋“œ๋Š” ๊ฒƒ์„ ๋งํ•จ
  • ๋ ˆ์ด์–ด : ๋„์ปค๋Š” ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€์™€ ๋น„๊ต ํ–ˆ์„ ๋•Œ, ๋‹ค๋ฅธ ๋ถ€๋ถ„
  • ๊ธฐ๋ณธ์ ์œผ๋กœ ๋„์ปค๋Š” git์ฒ˜๋Ÿผ ๋ฒ„์ „๊ด€๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋ฉฐ, ๊ธฐ์กด๊ณผ ๋‹ค๋ฅธ ๋ ˆ์ด์–ด๋งŒ ์ด๋ฏธ์ง€ ์ฒ˜๋ฆฌํ•˜๊ณ , ๋ฒ ์ด์Šค ์ด๋ฏธ์ง€์— ๋”ํ•ด ์‚ฌ์šฉํ•˜๋Š” ๋ฐฉ์‹

์ฟ ๋ฒ„๋„คํ‹ฐ์Šค

https://github.com/banziha104/DockerExample/blob/master/markdown/ink8s/01_Kubernetes.md


๋„์ปค

๋„์ปคํŒŒ์ผ ์ž‘์„ฑ๋ฒ• ๋ฐ ์‚ฌ์šฉ๋ฒ•

  • docker ํŒŒ์ผ ์ž‘์„ฑ
# ์–ด๋–ค ์ด๋ฏธ์ง€๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ• ๊ฑด์ง€ ์„ค์ •
FROM ubuntu:14.04

# ๋ฉ”์ธํ„ฐ์ด๋„ˆ ์ •๋ณด
MAINTAINER Foo Bar <[email protected]>

# ์…ธ ์Šคํฌ๋ฆฝํŠธ ํ˜น์€ ๋ช…๋ น์„ ์‹คํ–‰
RUN apt-get update
RUN apt-get install -y nginx
RUN echo "\ndaemon off" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx

# ํ˜ธ์ŠคํŠธ์™€ ๊ณต์œ ํ•  ๋””๋ž™ํ† ๋ฆฌ ๋ช…๋ น
VOLUME ["/data","/etc/nginx/site-enabled","/var/log/nginx"]

# CMD ์—์„œ ์„ค์ •ํ•œ ํŒŒ์ผ์ด ์‹คํ–‰๋  ๋””๋ ‰ํ„ฐ๋ฆฌ
WORKDIR /etc/nginx

# ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ์‹œ์ž‘์™ธ์—ˆ์„ ๋–„ ์‹คํ–‰ํ•  ์‹คํ–‰ ํŒŒ์ผ ๋˜๋Š” ์…ธ์Šคํฌ๋ฆฝํŠธ
CMD ["nginx"]

# Host์™€ ์—ฐ๊ฒฐํ•  ํฌํŠธ ๋ฒˆํ˜ธ
EXPOSE 80
EXPOSE 443
  • ์ „์ฒด ์ปจํ…Œ์ด๋„ˆ ์ข…๋ฃŒ : docker rm -f $(docker ps -a -q)
  • ์ „์ฒด ์ด๋ฏธ์ง€ ์ œ๊ฑฐ : docker rmi $(docker images -q)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.