LoginSignup
15
14

More than 5 years have passed since last update.

DockerのAlpine Linuxを試す

Last updated at Posted at 2017-01-12

各種設定見る系

どこまで入ってるかよくわからない。。
コンテナの中からメモリやCPU利用量は取れる?

ps aux

ifconfig

色々インストールしてみる

なるべく最新版を使いたいので、出来る限りビルドしてみるなど。
いずれもalpine:3.5で試しています。

※なお、Dockerfileにするときは層を減らしたりして良い感じにすると思いますが、一旦shellでごにょごにょいじります。

apkのpackage群はこちら。
https://pkgs.alpinelinux.org/packages

Java

alpine-sh
# library install
apk add --update openjdk8

# check
java -version
openjdk version "1.8.0_111"

ruby

alpine-sh
# library install
apk add --update ruby

# check
ruby -v
2.3.3

python2

alpine-sh
# library install
apk add --update python

# check
python -V
2.7.12

python3

alpine-sh
PYTHON_VERSION=3.5.2

# library install
apk --update --no-cache add --virtual build-temp build-base openssl

# source code
wget "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_V
ERSION}.tgz"
tar xzvf Python-${PYTHON_VERSION}.tgz
cd Python-${PYTHON_VERSION}

# build
./configure
make
make install

# check
python3 -V
-> Python 3.5.2

nodejs

alpine-sh
# env
NODEJS_VERSION=6.9.4

# library install
apk --update --no-cache add --virtual build-temp python build-base linux-headers

# source code
wget http://nodejs.org/dist/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}.tar.gz
tar xzvf node-v${NODEJS_VERSION}.tar.gz
cd node-v${NODEJS_VERSION}

# build
./configure --prefix=/opt/node --without-snapshot --fully-static
make
make install

# clean up
apk del build-temp
rm -rf node-v${NODEJS_VERSION} node-v${NODEJS_VERSION}.tar.gz

# path
PATH=${PATH}:/opt/node/bin

# check
node -v
-> v6.9.4

nginx

refs: http://qiita.com/asakaguchi/items/484ba262965ef3823f61

alpine-sh
# env
NGINX_VERSION=1.11.8

# library install
apk --update --no-cache add zlib-dev openssl-dev pcre-dev
apk --no-cache add --virtual build-temp build-base

# source code
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar xzvf nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}

# build
./configure \
  --with-http_ssl_module \
  --with-http_gzip_static_module \
  --prefix=/usr/share/nginx \
  --sbin-path=/usr/local/sbin/nginx \
  --conf-path=/etc/nginx/conf/nginx.conf \
  --pid-path=/var/run/nginx.pid \
  --http-log-path=/var/log/nginx/access.log \
  --error-log-path=/var/log/nginx/error.log
make
make install

# clean up
apk del build-temp
rm -rf nginx-${NGINX_VERSION} nginx-${NGINX_VERSION}.tar.gz
15
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
14