/var/log/seiji

18 Jul 2014

boot2docker memory assignment

boot2docker memory assignment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ boot2docker info | jq .
{
  "SerialFile": "/Users/seiji/.boot2docker/boot2docker-vm.sock",
  "SSHPort": 2022,
  "DockerPort": 2375,
  "BootOrder": null,
  "Flag": 0,
  "OSType": "",
  "Name": "boot2docker-vm",
  "UUID": "12755ff4-b054-4a87-81cc-f4ce041f8fd8",
  "State": "running",
  "CPUs": 4,
  "Memory": 2048,
  "VRAM": 8,
  "CfgFile": "/Users/seiji/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox",
  "BaseFolder": "/Users/seiji/VirtualBox VMs/boot2docker-vm"
}

$ boot2docker destroy
$ boot2docker init -m 4096
$ boot2docker info | jq .
{
  "SerialFile": "/Users/seiji/.boot2docker/boot2docker-vm.sock",
  "SSHPort": 2022,
  "DockerPort": 2375,
  "BootOrder": null,
  "Flag": 0,
  "OSType": "",
  "Name": "boot2docker-vm",
  "UUID": "56ff7f05-746b-46b5-8e1c-f9c1f61e5b1b",
  "State": "poweroff",
  "CPUs": 4,
  "Memory": 4096,
  "VRAM": 8,
  "CfgFile": "/Users/seiji/VirtualBox VMs/boot2docker-vm/boot2docker-vm.vbox",
  "BaseFolder": "/Users/seiji/VirtualBox VMs/boot2docker-vm"
}

28 Jun 2014

Docker excludes files when sending to its daemon

It seems that this feature is supported. Rebased Dockerignore

Add Dockerfile

1
2
$ cat Dockerfile
FROM centos:6.4

Add ignore files

1
2
3
4
5
6
$ cat .dockerignore
.bundle
.git
log
tmp
vendor

Build image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ time docker build -t centos:noignore .  
Sending build context to Docker daemon 165.4 MB
Sending build context to Docker daemon
Step 0 : FROM centos:6.4
 ---> 539c0211cd76
Successfully built 539c0211cd76
docker build -t centos:noignore .  4.09s user 2.68s system 32% cpu 20.804 total

$ time docker-1.0.1-dev build -t centos:ignore
Sending build context to Docker daemon  1.46 MB
Sending build context to Docker daemon 
Step 0 : FROM centos:6.4
 ---> 539c0211cd76
Successfully built 539c0211cd76
docker-1.0.1-dev build -t centos:ignore .  2.23s user 0.34s system 91% cpu 2.824 total

Appendix

Setting Up a Dev Environment on OSX

1
2
3
4
5
6
7
8
9
10
11
$ git clone https://git@github.com/dotcloud/docker

$ cd docker

$ make build

$ export DOCKER_CLIENTONLY=1 

$ export AUTO_GOPATH=1

$ hack/make.sh dynbinary

11 Mar 2014

Setting the HOSTALIASES

Setting the HOSTALIASES

1
2
3
4
5
6
7
$ echo "g google.com" > /etc/host.aliases

$ echo "export HOSTALIASES=/etc/host.aliases" >> /etc/profile

$ source /etc/profile

$ ping g

08 Mar 2014

Pidora on Raspberry Pi

Download

1
2
3
4
5
6
7
8
9
$ curl -L -o pidora.zip http://downloads.raspberrypi.org/pidora_latest

$ unzip pidora.zip

$ openssl md5 pidora-18-r2c.img
MD5(pidora-18-r2c.img)= 9e2d83c0f1572d65b60554227583b35c

$ cat pidora-18-r2c.img.md5sum 
9e2d83c0f1572d65b60554227583b35c  pidora-18-r2c.img

Copy image to SDCard

1
2
3
4
5
6
7
8
9
10
$ df -h
Filesystem      Size   Used  Avail Capacity  iused   ifree %iused  Mounted on
/dev/disk1s1    29Gi  2.3Mi   29Gi     1%        0       0  100%   /Volumes/UNTITLED

$ diskutil unmount /dev/disk1s1

$ sudo dd bs=1m if=pidora-18-r2c.img of=/dev/rdisk1
1709+1 records in
1709+1 records out
1792275456 bytes transferred in 106.479653 secs (16832093 bytes/sec)

Enabling headless mode

1
2
3
4
5
6
7
8
9
10
11
12
13
$ df -h
Filesystem      Size   Used  Avail Capacity  iused   ifree %iused  Mounted on
/dev/disk1s1    50Mi   17Mi   33Mi    35%      512       0  100%   /Volumes/boot

$ cat << EOF > /Volumes/boot/headless
IPADDR=192.168.1.105
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
RESIZE
SWAP=512
EOF

$ diskutil unmount /dev/disk1s1

Create swap file

1
2
3
4
5
6
7
8
9
$ ssh root@192.168.1.105

[root@raspi ~]# dd if=/dev/zero of=/swapfile bs=1024 count=65536

[root@raspi ~]# mkswap /swapfile

[root@raspi ~]# swapon /swapfile

[root@raspi ~]# echo '/swapfile swap swap defaults 0 0' >>/etc/fstab