Skip to content

Instantly share code, notes, and snippets.

@hiboma
Last active December 18, 2015 22:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiboma/5857146 to your computer and use it in GitHub Desktop.
Save hiboma/5857146 to your computer and use it in GitHub Desktop.
running Docker on SL6

Docket SL6 で動かすに当たっていろいろ自分で用意しないといけません

  • aufs 付きカーネル
  • iptables の addrtype
  • go
  • lxc
  • cgroup
  • docker

苦労するだけであまり価値が無い

カーネルをビルドできるように丸っと入れる

sudo yum groupinstall 'Development Tools'

aufs のパッチが当たったカーネルをビルド

git clone git://github.com/sfjro/aufs3-linux.git
git checkout aufs3.9
make oldconfig
make menuconfig

いろいろオプション足す

 Symbol: AUFS_FS [=y]                                                                       
 Type  : boolean                                                                            
 Prompt: Aufs (Advanced multi layered unification filesystem) support                       
   Defined at fs/aufs/Kconfig:1                                                             
   Depends on: MISC_FILESYSTEMS [=y]                                                        
   Location:                                                                                
     -> File systems                                                                        
 (6)   -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y])                                 
                                                                                            
Symbol: NETFILTER_XT_MATCH_ADDRTYPE [=n] 
 Type  : tristate
 Prompt: "addrtype" address type match support
   Defined at net/netfilter/Kconfig:798
   Depends on: NET [=y] && INET [=y] && NETFILTER [=y] && NETFILTER_XTABLES [=y] && NETFILTER_ADVANCED [=y]
   Location:
     -> Networking support (NET [=y])
       -> Networking options
         -> Network packet filtering framework (Netfilter) (NETFILTER [=y])
           -> Core Netfilter Configuration
 (1)         -> Netfilter Xtables support (required for ip_tables) (NETFILTER_XTABLES [=y])


 Symbol: NF_NAT_IPV4 [=m]                                                                                     
 Type  : tristate                                                                                             
 Prompt: IPv4 NAT                                                                                             
   Defined at net/ipv4/netfilter/Kconfig:133                                                                  
   Depends on: NET [=y] && INET [=y] && NETFILTER [=y] && IP_NF_IPTABLES [=m] && NF_CONNTRACK_IPV4 [=m]       
   Location:                                                                                                  
     -> Networking support (NET [=y])                                                                         
       -> Networking options                                                                                  
         -> Network packet filtering framework (Netfilter) (NETFILTER [=y])                                   
           -> IP: Netfilter Configuration                                                                     
 (2)         -> IP tables support (required for filtering/masq/NAT) (IP_NF_IPTABLES [=m])                     
   Selects: NF_NAT [=m]                                                                                       

                                                                  
 Symbol: MEMCG [=y]                                               
 Type  : boolean                                                  
 Prompt: Memory Resource Controller for Control Groups            
   Defined at init/Kconfig:825                                    
   Depends on: CGROUPS [=y] && RESOURCE_COUNTERS [=y]             
   Location:                                                      
     -> General setup                                             
       -> Control Group support (CGROUPS [=y])                    
 (3)     -> Resource counters (RESOURCE_COUNTERS [=y])            
   Selects: MM_OWNER [=y]                                         
# ccache とか 並列度とかは適当に
make 
sudo make modules_install
sudo make install

go は バイナリを置けば良い

wget http://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
tar xvfz go1.1.1.linux-amd64.tar.gz
sudo mv go /usr/local
sudo ln -sv /usr/local/go/bin/go  /usr/local/bin

lxc は RPM としてビルドして入れましょう

wget http://lxc.sourceforge.net/download/lxc/lxc-0.9.0.tar.gz
rpmbuild -ta lxc-0.9.0.tar.gz
sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/lxc-0.9.0-1.el6.x86_64.rpm ~/rpmbuild/RPMS/x86_64/lxc-libs-0.9.0-1.el6.x86_64.rpm

docker のインストール

curl get.docker.io | sudo sh -x
sudo ln -sv /usr/local/bin/docker /usr/bin

ip_foward しないと ホストOS とコンテナ間でパケットが転送されない

sudo sysctl -w net.ipv4.ip_forward=1 

cgroup も マウント ...

sudo mount -t cgroup cgroup /cgroup

いでよ docker !

sudo /usr/bin/docker -d 

enjoy

docker run base /bin/echo hi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment