Docker image size optimization

Basic:
https://philipzheng.gitbooks.io/docker_practice/content/image/create.html

Advanced:

https://ypereirareis.github.io/blog/2016/02/15/docker-image-size-optimization/

廣告

Docker 從入門到實踐

# 匯入image
cat centos7.tar | sudo docker import – test/centos:7
# 進入centos
sudo docker run –name centos -it test/centos:7 bash
# 啟動已休眠的container
sudo docker start centos
# 執行已啟動的container
sudo docker exec -it centos bash
# 匯出container
sudo docker export centos > centos.tar
#存入image
sudo docker commit -m “Added nodejs" -a “John" debian test/centos:v2

https://philipzheng.gitbooks.io/docker_practice/content/image/create.html

Mac 使用 Vagrant 搭建 CoreOS + Docker 環境

1. 安裝 Vagrant
。clone core-os
執行 vagrant:
。vagrant up
。vagrant ssh

2. 安裝 docker ubuntu image
。docker run -i -t ubuntu:13.10 bash
安裝 docker ui image
。docker run -d -p 9000:9000 –privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui
。瀏覽器輸入: http://172.17.8.101:9000  (備註: Vagrantfile 的 config.vm.network 可改 ip)

3. 下次啟動 docker container 指令
。查詢所有 container: docker ps -a
。啟動已存在的 container: docker start <ID or name>
。ssh 進 container: docker exec -i -t <ID or name> bash  (備註: 執行該 container 的 bash)
。刪除 container: docker rm <ID or name>
。Mount Volume: docker run -i -t -v /path/to/host:/path/to/container <Image> bash (備註: 需開新的 container)
。匯出 container: docker export <ID or name> > myImage.tar
。匯入 container: cat myImage.tar | docker import – <Repository name>:<tag>
。查詢 image: docker images

Docker – Some materials

http://www.yankay.com/docker-paas-for-any-application/

http://tiewei.github.io/cloud/Docker-Getting-Start/