Dockerでコンテナが動作した
昨日の続き。
exec format errorってなんじゃい
"exec format error"っていうからには、別プラットフォームのものを動作させようとしているんじゃないかと推測。自機は32bit上のubuntuなので、昨日pullしたもの(ubuntu:latest)はもしかしたら64bitOSのイメージなんじゃないか。
じゃあ32bitのイメージはあるかな。
という推測で32bitでsearchをかけてみる。
$ docker search 32bit/ubuntu NAME DESCRIPTION STARS OFFICIAL AUTOMATED 32bit/ubuntu Ubuntu for i386 (32bit) 13 32bit/ubuntu-upstart ubuntu-upstart for i386 (32bit) 1 osrf/ubuntu_32bit Ubuntu 32bit images 1 cato1971/ubuntu-32bit Base Ubuntu 32 bit image 0 guruvan/ubuntu-32bit 0 souzaonofre/ubuntu-32bits Ubuntu 32bits images 0 pgeraghty/slimerjs_ubuntu_32bit 0 [OK] pgeraghty/tinyproxy_ubuntu_32bit 0 [OK] cato1971/ubuntu Base 32-bit Ubuntu image from cato1971/ubu... 0 [OK] patrickjahns/ubuntu-debootstrap 32bit (i386) ubuntu-debootstrap images for... 0 [OK] octoblu/ubuntu-12.04-32bit-node 0 [OK] pgeraghty/casperjs_slimerjs_ubuntu_32bit 0 [OK] mcandre/docker-ubuntu-32bit base images for 32bit Ubuntu 0 pyro225/ubuntu-32bit Ubuntu for 32bit 0
おお、どうやらそれでビンゴかも。
32bit/ubuntuをpull
一番上の32bit/ubuntuをpullする。
$ docker pull 32bit/ubuntu Pulling repository 32bit/ubuntu 6de534a1b6e3: Download complete $ docker images REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE <none> <none> 29460ac93442 2 weeks ago 188.4 MB 32bit/ubuntu 14.04 6de534a1b6e3 8 months ago 290.7 MB
動かしてみる
ということで動かしてみる。
$ docker run -it 32bit/ubuntu:14.04 /bin/bash root@b3c7273a5854:/# pwd / root@b3c7273a5854:/# ls -ltr total 60 drwxr-xr-x 2 root root 4096 Apr 10 2014 mnt drwxr-xr-x 2 root root 4096 Apr 10 2014 home drwxr-xr-x 2 root root 4096 Apr 10 2014 boot drwxr-xr-x 11 root root 4096 Oct 31 2014 var drwxr-xr-x 10 root root 4096 Oct 31 2014 usr drwxr-xr-x 2 root root 4096 Oct 31 2014 srv drwx------ 2 root root 4096 Oct 31 2014 root drwxr-xr-x 2 root root 4096 Oct 31 2014 opt drwxr-xr-x 2 root root 4096 Oct 31 2014 media drwxr-xr-x 7 root root 4096 Oct 31 2014 run drwxr-xr-x 12 root root 4096 Oct 31 2014 lib drwxr-xr-x 2 root root 4096 Oct 31 2014 sbin drwxr-xr-x 2 root root 4096 Oct 31 2014 bin drwxrwxrwt 2 root root 4096 Oct 31 2014 tmp drwxr-xr-x 61 root root 4096 Jul 24 02:23 etc dr-xr-xr-x 253 root root 0 Jul 24 02:23 proc dr-xr-xr-x 13 root root 0 Jul 24 02:23 sys drwxr-xr-x 4 root root 360 Jul 24 02:23 dev
や、これでいい。デフォルトは64bitOSイメージなんですな。
ホストOSが32bitの場合は、ちゃんとイメージも32bitのものをpullすると幸せになれる。