Mecab-ko( https://github.com/koorukuroo/mecab-ko )와 Flask를 이용한 형태소 분석입니다.
- Windows : https://download.docker.com/win/beta/InstallDocker.msi
- Mac : https://download.docker.com/mac/beta/Docker.dmg
- brew cask install virtualbox --appdir=/Applications
- docker-machine create --driver virtualbox default
- docker-machine env default
- docker-machine ip default
- sudo route add 172.17.0.0/16 192.168.99.100
- docker-machine ssh default
- docker pull koorukuroo/mecab-ko-web
- docker run -d koorukuroo/mecab-ko-web
- exit
- curl 172.17.0.2:5000/?text=테스트
- https://gist.github.com/makuk66/8380c901a9a620df7023
- https://forums.docker.com/t/access-host-not-vm-from-inside-container/11747/30
- moby/moby#19119
- https://docs.docker.com/docker-for-mac/networking/#/i-can-t-ping-my-containers
- sudo apt-get install apt-transport-https ca-certificates
- sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
- sudo bash -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list'
- sudo apt-get update
- sudo apt-get install linux-image-extra-$(uname -r)
- sudo apt-get install docker-engine -y
- sudo docker pull koorukuroo/mecab-ko-web
- sudo docker run -d koorukuroo/mecab-ko-web
sudo iptables -t nat -A PREROUTING -p tcp --dport 5000 -j DNAT --to-destination 172.17.0.2:5000
$ 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)
>>> import urllib2
>>> response = urllib2.urlopen('http://172.17.0.43:5000/?text=안녕')
>>> text = response.read()
>>> print text
안녕 NNG,*,T,안녕,*,*,*,*
EOS
도커 정보 https://hub.docker.com/r/koorukuroo/mecab-ko-web/
- 컨테이너 목록 출력
- 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