{"id":29091,"date":"2017-01-24T03:01:45","date_gmt":"2017-01-23T18:01:45","guid":{"rendered":"http:\/\/ur.edu-connect.net\/?p=29091"},"modified":"2024-02-03T23:08:02","modified_gmt":"2024-02-03T14:08:02","slug":"docker-for-mac%e3%81%a7%e4%bd%9c%e3%81%a3%e3%81%9fubuntu%e3%82%b3%e3%83%b3%e3%83%86%e3%83%8a%e5%86%85%e3%81%aegui%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%ef%bc%88spyder%ef%bc%89%e3%82%92%e4%bd%bf","status":"publish","type":"post","link":"https:\/\/ur.edu-connect.net\/archives\/29091","title":{"rendered":"Docker for Mac\u3067\u4f5c\u3063\u305fUbuntu\u30b3\u30f3\u30c6\u30ca\u5185\u306eGUI\u30d7\u30ed\u30b0\u30e9\u30e0\uff08spyder\uff09\u3092\u4f7f\u3046"},"content":{"rendered":"\n
Docker for Mac\u3092\u4f7f\u3063\u3066\u958b\u767a\uff0f\u5206\u6790\u74b0\u5883\u3092\u8a66\u9a13\u7684\u306b\u4f5c\u3063\u3066\u307f\u305f\u969b\u306e\u8a18\u9332\u3067\u3059\u3002\u6bcd\u8266\u306eMac\u3092\u6c5a\u3055\u305a\u306bPython\u306e\u958b\u767a\uff0f\u5206\u6790\u74b0\u5883\u3092\u4f5c\u308c\u305d\u3046\u3060\u3068\u3044\u3046\u3053\u3068\u3067\u3001Docker\u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u3002Mac\u306e\u5834\u5408\u306fMac OSX\u306e\u4e0a\u306bLinux\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308b\u306e\u3067\u3001\u8efd\u91cf\u3068\u306f\u8a00\u3048\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u74b0\u5883\u3092\u9694\u96e2\u3067\u304d\u3001\u30b3\u30f3\u30c6\u30ca\u3054\u3068\u914d\u5e03\u3057\u305f\u308a\u3067\u304d\u308b\u306e\u304c\u9b45\u529b\u3067\u3059\u306d\u3002<\/p>\n\n\n\n
\u69cb\u6210\u306f\u6b21\u306e\u901a\u308a\u3002<\/p>\n\n\n\n
\u4ee5\u4e0b\u3001\u4f5c\u696d\u5185\u5bb9\u3002MacBook Pro retina\uff08late 2012\u3001OSX Sierra 10.12.2\uff09\u3068MacBook Air\uff08mid 2013\u3001OSX Sierra 10.12.2\uff09\u3067\u52d5\u4f5c\u78ba\u8a8d\u6e08\u307f\u3067\u3059\u3002<\/p>\n\n\n\n
$ brew cask install xquartz<\/pre>\n<\/li>\n\n\n\n
$ open -a xquartz\n$ ip=$(ifconfig en0 | grep inet | awk '$1==\"inet\" {print $2}')\n$ xhost + $ip\n<\/pre>\nXQuartz\u3092\u958b\u304d\u3001\u6bcd\u8266\u306eMac\u306eIP\u3092\u53d6\u5f97\u3057\u3001X Window\u306e\u63a5\u7d9a\u3092\u8a31\u53ef\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n
FROM ubuntu:16.04\nMAINTAINER Yu Ara\n\n# Change apt repository to Jaist and update package info\nRUN sed -i.bak -e \"s%https:\/\/archive.ubuntu.com\/ubuntu\/%https:\/\/ftp.jaist.ac.jp\/pub\/Linux\/ubuntu\/%g\" \/etc\/apt\/sources.list\nRUN apt-get update --fix-missing\n\n# Japanese language support\nRUN localedef -i ja_JP -c -f UTF-8 -A \/usr\/share\/locale\/locale.alias ja_JP.UTF-8\nENV LANG ja_JP.utf8\nRUN apt-get install -y fontconfig\nRUN apt-get install -y fonts-takao\n\n# Install system packages\nRUN apt-get install -y wget bzip2 ca-certificates \\\nlibglib2.0-0 libxext6 libsm6 libxrender1 \\\ngit mercurial subversion vim\n\n# Install latest miniconda3 to \/opt\/conda\nRUN echo 'export PATH=\/opt\/conda\/bin:$PATH' > \/etc\/profile.d\/conda.sh && \\\nwget --quiet https:\/\/repo.continuum.io\/miniconda\/Miniconda3-4.1.11-Linux-x86_64.sh -O ~\/miniconda.sh && \\\n\/bin\/bash ~\/miniconda.sh -b -p \/opt\/conda && \\\nrm ~\/miniconda.sh\n\nENV PATH \/opt\/conda\/bin:$PATH\n\n# Install Tini\nRUN apt-get install -y curl grep sed dpkg && \\\nTINI_VERSION=`curl https:\/\/github.com\/krallin\/tini\/releases\/latest | grep -o \"\/v.*\\\"\" | sed 's:^..\\(.*\\).$:\\1:'` && \\\ncurl -L \"https:\/\/github.com\/krallin\/tini\/releases\/download\/v${TINI_VERSION}\/tini_${TINI_VERSION}.deb\" > tini.deb && \\\ndpkg -i tini.deb && \\\nrm tini.deb && \\\napt-get clean\n\n# Update conda & install conda package\nRUN conda update -y conda\nRUN conda install -y ipython numpy scipy pandas \\\nmatplotlib seaborn scikit-learn spyder xlrd\n\n# Install graphic driver\nRUN apt-get install -y libgl1-mesa-dri libgl1-mesa-glx --no-install-recommends\nRUN dbus-uuidgen > \/etc\/machine-id\n\nENTRYPOINT [ \"\/usr\/bin\/tini\", \"--\" ]\nCMD [ \"bin\/bash\" ]\n<\/pre>\u3053\u306eDockerfile\u306e\u4f5c\u6210\u306b\u969b\u3057\u3066\u306f\u3001\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n
$ docker build -t ur\/python35spyder:latest<\/pre>\n<\/li>\n\n\n\n
$ docker run -it --name spyder -e DISPLAY=$ip:0 -e USER=root \\\n-v \/tmp\/.X11-unix:\/tmp\/.X11-unix -v \/Users:\/Users ur\/python35spyder:latest<\/pre>\n\u30b3\u30f3\u30c6\u30ca\u540d\u306fspyder\u3068\u3057\u3001\u4e00\u3064\u76ee\u306e-e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067DISPLAY\u306e\u74b0\u5883\u5909\u6570\u3092\u6e21\u3057\u3001\u4e8c\u3064\u76ee\u306e-e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u30b3\u30f3\u30c6\u30ca\u5185\u306eUbuntu\u30e6\u30fc\u30b6\u3092root\u306b\u6307\u5b9a\u3001\u4e00\u3064\u76ee\u306e-v\u30aa\u30d7\u30b7\u30e7\u30f3\u3067X Window\u3092\u63a5\u7d9a\u3001\u4e8c\u3064\u76ee\u306e-v\u30aa\u30d7\u30b7\u30e7\u30f3\u3067Mac\u306eUsers\u30d5\u30a9\u30eb\u30c0\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u30de\u30a6\u30f3\u30c8\u3001\u6700\u5f8c\u306b\u30b3\u30f3\u30c6\u30ca\u3067\u4f7f\u7528\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<\/li>\n\n\n\n
# spyder &<\/pre>\nMac\u306e\u753b\u9762\u4e0a\u306bUbuntu\u306eSpyder\u304c\u73fe\u308c\u307e\u3059\u3002<\/p>\n