Dockerの諸々をgarbage collectionする

Public Beta になったDocker for Macを使い始めた今日このごろimageが増えてきました。 コンテナやイメージの削除はめんどうなので、ナニカいい方法はないかと考えていました。

spotify/docker-gc を利用する

github.com

docker runする

$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc spotify/docker-gc

docker runのaliasを貼る

alias docker-gc='docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /etc:/etc spotify/docker-gc'

support対象外のOSではdocker imageを使ってやれとのこと

github.com

crowiというWikiをdockerで動かすためのナニカ

Crowiとは

github.com

docker-composeで環境を作る

github.com

docker-compose.yml

web:
  build: .
  ports:
    - "80:80"
  links:
    - datastore
    - session
  environment:
    PORT: 80
    NODE_ENV: development
    MONGO_URI: mongodb://datastore:27017/crowi
    REDIS_URL: redis://session:6379
datastore:
  image: mongo
  ports:
    - "27017:27017"
session:
  image: redis
  ports:
    - "6379:6379"
  • service名は /etc/hosts に書き込まれるので、service名でつながれる
  • crowiには mongoとredisのミドルウェアが必要なのでそれを使えるように書く

ちなみに vagrant の実行環境もあったりする

github.com

最後に Crowi のステッカーあるらしいよ!!

メモ用としてjunkfile.vimを使う

junkfile.vimとは

github.com

使い方

  • unite.vimが必要

junkfile一覧

:Unite junkfile

新規にjunkfileを作成

:Unite junkfile/new junkfile -start-insert

junkfileを削除

:Unite junkfile

削除したいファイルまで移動 (d)

設定例

if neobundle#tap('junkfile.vim') "{{{
  let g:junkfile#directory = '~/.memo'
  nnoremap <silent> ,e  :<C-u>Unite junkfile/new junkfile -start-insert<CR>
  call neobundle#untap()
endif

document

Dietcube使ってみた

Dietcubeとは?

speakerdeck.com

github.com

PHP BLT #2 のLT中に公開されたフレームワークで、symfonyをいい感じにうすくしたフレームワークかなーと。

簡単に使ってみた

github.com

ところで

抽選なので今から申し込んでも間に合うよ!

phpblt.connpass.com

PHP実行環境をdockerで作る

圧倒的今更感

メモだけ

ディレクトリ構成

.
├── Dockerfile
├── apache-config.conf
├── application
│   └── webroot
│       └── index.php
└── docker-compose.yml

各ファイル

Dockerfile

FROM php:5.6-apache
RUN a2enmod rewrite

EXPOSE 80

# Update the default apache site with the config we created.
ADD apache-config.conf /etc/apache2/sites-enabled/000-default.conf

apache-config.conf

<VirtualHost *:80>
#ServerName www.example.com

# ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/webroot

<Directory /var/www/html/webroot>
  # ...
</Directory>

ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

docker-compose.yml

php-web:
  build: .
  ports:
    - "80:80"
  volumes:
    - ./application:/var/www/html

application_webroot_index.php

<?php
phpinfo();

構築

$ docker-machine create --driver virtualbox --virtualbox-cpu-count 2 --virtualbox-memory 4096 php-local
$ docker-machine env php-local
$ eval "$(docker-machine env php-local)"
$ cd /path/to/workdir
$ docker-compose build
$ docker-compose up

あとは docker-machine env php-local で確認した IPにアクセス。 docker-compose.yml に他のミドルウェアとかを追記しつつ作業していく

PHP Standards Recommendations

www.php-fig.org

ACCEPTED

NUM TITLE EDITOR COORDINATOR SPONSOR
0 Autoloading Standard N/A N/A N/A
1 Basic Coding Standard N/A N/A N/A
2 Coding Style Guide N/A N/A N/A
3 Logger Interface Jordi Boggiano N/A N/A
4 Autoloading Standard Paul M. Jones Phil Sturgeon Larry Garfield
7 HTTP Message Interface Matthew Weier O'Phinney Beau Simensen Paul Jones

acceptされたものに0から順番に番号がふられているとおもったけどバラバラだった