Skip to content

Latest commit

 

History

History
93 lines (84 loc) · 3.03 KB

README.md

File metadata and controls

93 lines (84 loc) · 3.03 KB

mecab-ko-web

Mecab-ko( https://github.com/koorukuroo/mecab-ko )와 Flask를 이용한 형태소 분석입니다.

Docker Installation

https://docs.docker.com/

Mac

  1. brew cask install virtualbox --appdir=/Applications
  2. docker-machine create --driver virtualbox default
  3. docker-machine env default
  4. docker-machine ip default
  5. sudo route add 172.17.0.0/16 192.168.99.100
  6. docker-machine ssh default
  7. docker pull koorukuroo/mecab-ko-web
  8. docker run -d koorukuroo/mecab-ko-web
  9. exit
  10. curl 172.17.0.2:5000/?text=테스트
References

Ubuntu 14.04 LTS

  1. sudo apt-get install apt-transport-https ca-certificates
  2. sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  3. sudo bash -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list'
  4. sudo apt-get update
  5. sudo apt-get install linux-image-extra-$(uname -r)
  6. sudo apt-get install docker-engine -y
  7. sudo docker pull koorukuroo/mecab-ko-web
  8. sudo docker run -d koorukuroo/mecab-ko-web
For Server

sudo iptables -t nat -A PREROUTING -p tcp --dport 5000 -j DNAT --to-destination 172.17.0.2:5000

Usage

Docker 실행

$ sudo docker pull koorukuroo/mecab-ko-web
$ sudo docker run -i -t koorukuroo/mecab-ko-web
172.17.0.43 (Docker Container IP)
127.0.0.1
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Python

>>> import urllib2
>>> response = urllib2.urlopen('http://172.17.0.43:5000/?text=안녕')
>>> text = response.read()
>>> print text
안녕	NNG,*,T,안녕,*,*,*,*
EOS

Docker

도커 정보 https://hub.docker.com/r/koorukuroo/mecab-ko-web/

기본적인 Docker 명령어

  • 컨테이너 목록 출력
  • docker ps -a
  • 실행된 컨테이너 목록 출력
  • docker ps
  • 컨테이너 종료
  • docker kill
  • 이미지 목록 출력
  • docker images
  • 컨테이너 삭제
  • docker rm
  • 존재하는 컨테이너 전체 삭제
  • docker rm $(docker ps -a -q)
  • 이미지 삭제
  • docker rmi koorukuroo/mecab-ko-web
  • 존재하는 이미지 전체 삭제
  • docker rmi $(docker images -q)
  • 컨테이너 접속
  • docker attach
  • Dockerfile 빌드
  • docker build -t koorukuroo/mecab-ko-web .
  • 빌드된 Dockerfile 백그라운드에서 실행
  • docker run -d -t koorukuroo/mecab-ko-web
  • 빌드된 Dockerfile 인터렉티브 모드에서 실행
  • docker run -i -t koorukuroo/mecab-ko-web
  • 빌드된 Dockerfile bash로 진입
  • docker run -i -t koorukuroo/mecab-ko-web /bin/bash
  • 네트워크 환경 체크
  • docker network inspect bridge