53
53

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

(メモ)Chef+Docker+Test-kitchen+Serverspec

Last updated at Posted at 2014-06-27

OSX上でお手軽chefci環境の再構築めも(整理中)
vagrantは使わない

  • Ruby >= 2.0
  • Docker >= 1.0(OSX,boot2docker)
  • Test-kitchen >= 1.0
  • Serverspec

準備(Ruby,Docker)

# インストール
brew update
brew install boot2docker docker
# 確認
boot2docker up
boot2docker ip

※virtualboxインストール直後などはhost onlyネットワークが上手く動かず再起動が必要かも

docker pull centos
docker images

Test-kitchen + Docker

gem install kitchen-docker --no-rdoc --no-ri

kitchen init --driver=kitchen-docker
.kitchen.yml(例)
driver:
  name: docker
  binary: /usr/local/bin/docker
  socket: <%= ENV['DOCKER_HOST'] %>

platforms:
  - name: centos-6.4
    driver_config:
      image: centos:6.4
      platform: centos
      privileged: true
kitchen test --destroy=never
kitchen list
kitchen login default-centos-64

Test-kitchen + Serverspec

おまけ

dockerコンテナ上でulimit変えたい

上記の方法がよさそう。下記はscriptで無理矢理変更する例。

docker@boot2docker-/var/lib/boot2docker/bootlocal.sh
#!/bin/sh
grep "ulimit -n 65535" /etc/init.d/docker && exit
sudo sed -i "s#^start() {#start() {\n    ulimit -n 65535#g" /etc/init.d/docker
sleep 3
sudo /etc/init.d/docker restart
dockerVMでアレコレする
53
53
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
53
53

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?