LoginSignup
6
6

More than 5 years have passed since last update.

体育会系 Docker Compose ハンズオン資料(3)〜 修正編 〜

Last updated at Posted at 2016-04-08

体育会系 Docker Compose ハンズオン資料(1)体育会系 Docker Compose ハンズオン資料(2) で不備があった部分の修正です。


修正

MySQL コンテナが exit 1 で落ちてしまい WordPress が起動しない

  • 現象

以下のように MySQL が起動しない場合、仮想マシンのメモリ不足が想定されます。特に VirtualBox を利用している場合に発生する可能性があります。

output
db_1  | MySQL init process in progress...
db_1  | MySQL init process in progress...
db_1  | MySQL init process in progress...
db_1  | MySQL init process failed.
handsondockercomposewordpress_db_1 exited with code 1
  • 対処

以下のように仮想マシンに swap 領域を追加して頂くか、一度、仮想マシンを削除した上でメモリを追加して仮想マシンを起動して頂くことで問題が解消します。

Vagrantfile
#
# swap ファイルを追加
#
Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.network :forwarded_port, host: 10080, guest: 80
  config.vm.boot_timeout = 360
  # add swap
  config.vm.provision :shell, inline: "fallocate -l 4G /swapfile && chmod 0600 /swapfile && mkswap /swapfile && swapon /swapfile && echo '/swapfile none swap sw 0 0' >> /etc/fstab"
  config.vm.provision :shell, inline: "echo vm.swappiness = 10 >> /etc/sysctl.conf && echo vm.vfs_cache_pressure = 50 >> /etc/sysctl.conf && sysctl -p"
end

ご指摘くださった hitokuno さん、有難うございます!

Vagranfile
#
# メモリを約 1GB に設定
#
Vagrant.configure(2) do |config|
  config.vm.box = "ubuntu/trusty64"  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.network :forwarded_port, host: 10080, guest: 80
  config.vm.provider "virtualbox" do |vm|
    vm.memory = 1024
  end
end

尚、1.3.3 は上記のように修正させて頂きました。


最後に

ご不便をおかけしてしまい申し訳ございませんでした!m(__)m

6
6
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
6
6