R使いのためのDocker「Rocker」をScalewayの物理サーバで動かす
フランスのベアメタルサーバホスティングサービスScalewayが前から気になってたので使ってみました。
Scalewayでは、月€2.99を払ってdeveloper accountにアップグレードするとDockerファイルをビルドしてつくった自作イメージを使うことができます。
Dockerサーバをつくる
↑のドキュメントを読むと、Requirementsとして
- You have an account and are logged into cloud.scaleway.com
- You have configured your SSH Key
- You have an additional volume attached to your server
- Your server is running the Docker image from the InstantApps
という記載があります。言われた通り、イメージにはImageHubからDockerを指定して、ボリュームをひとつ作ります。
helloworldをもってくる
Makefile
を使いたいだけなんですが、このイメージを使います。
git clone https://github.com/scaleway/image-helloworld
cd image-helloworld
RockerのDockerfileをとってくる
元のDockerfileは要らないので消して、RockerのDockerfileを取ってきます。
rm Dockerfile wget https://raw.githubusercontent.com/rocker-org/rocker/master/r-base/Dockerfile
イメージをビルド
ベースイメージはScaleway公式のものでなくてもいい気がするんですけど、よく分からないので公式のものをFROM
に指定しておきます。
## Emacs, make this -*- mode: sh; -*- FROM scaleway/debian:amd64-sid
そして、make install
します。これで追加のボリュームにイメージが書き込まれるので、そのスナップショットを別のサーバのイメージとして使うことができます。
make install
スナップショットを取る
まず電源を落とします(ただこれはsudo halt
だとうまく落ちなくて、結局コンソールから電源を落としました。)
sudo halt
Volumeのスナップショットをとります。
Volumeのスナップショットを使って新しいサーバをつくる
こんな感じ。
Rを立ち上げる
立ち上がりました。
root@scw-xxxxx:~# R R version 3.3.1 (2016-06-21) -- "Bug in Your Hair" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. >
感想
Scaleway、便利っぽいけどところどころよくわからない。。もうちょっとドキュメントが整ってアジアリージョンも選べるようになったらまた使ってみたいと思います。