FROM ubuntu:14.04 MAINTAINER Masato Shimizu <ma6ato@gmail.com>
ENV HOME /root
## apt-get update RUN sed -i~ -e 's/archive.ubuntu.com/ftp.jaist.ac.jp/' /etc/apt/sources.list \ && apt-get update
## Japanese Environment RUN DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-ja ENV LANG ja_JP.UTF-8 RUN update-locale LANG=ja_JP.UTF-8 RUN mv /etc/localtime /etc/localtime.org RUN ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
CMD [“executable”,”param1”,”param2”] (like an exec, this is the preferred form) CMD [“param1”,”param2”] (as default parameters to ENTRYPOINT) CMD command param1 param2 (as a shell)
CMD cd /root/gorilla && /usr/local/bin/lein gorilla :ip 0.0.0.0 :port 8080
build && run
イメージをビルドしてDockerコンテナを起動します。指定した8080ポートで起動しました。
$ docker build -t masato/gorilla . $ docker run -it --rm masato/gorilla Retrieving org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.pom from central Retrieving clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.pom from clojars Retrieving org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.jar from central Retrieving clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar from clojars Gorilla-REPL: 0.3.3 Started nREPL server on port 43110 Running at http://localhost:8080/worksheet.html . Ctrl+C to exit.
確認
GorillaコンテナのIPアドレスを確認します。
$ docker inspect -format="{{ .NetworkSettings.IPAddress }}" 5bc5a5a76a30 Warning: '-format' is deprecated, it will be replaced by '--format' soon. See usage. 172.17.2.3