dockerday2015: introduction to dockerfile

9
Trƒn Hœu Cưng (OLBIUS Vietnam) Introduction to Dockerfile Hà Nºi, 19/07/2015 1/9

Upload: docker-hanoi

Post on 17-Aug-2015

25 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: DockerDay2015: Introduction to Dockerfile

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 1 / 9

Page 2: DockerDay2015: Introduction to Dockerfile

Content

1 What is Dockerfile?

2 Dockerfile: Step by Step

3 Experience

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 2 / 9

Page 3: DockerDay2015: Introduction to Dockerfile

What is Dockerfile?

• A Dockerfile is a text document that contains all the commandsyou would normally execute manually in order to build a Dockerimage.

• Docker can build images automatically by reading the instructionsfrom a Dockerfile.

• Dockerfile = Image Representations.

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 3 / 9

Page 4: DockerDay2015: Introduction to Dockerfile

Dockerfile: Step by Step

1 v1: Basic command FROM, RUN, CMD

2 v2: Command COPY and EXPOSE

3 v3: Command VOLUME

4 v4: Final Dockerfile

Github: https://github.com/tranhuucuong91/tutorial-dockerfile.git

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 4 / 9

Page 5: DockerDay2015: Introduction to Dockerfile

Experience: Caching everywhere

• Caching software packages and third-party source code.

• Dockerfile: có 1 phiên bản cho lab và 1 phiên cho product. Với phiênbản cho lab, tối thiểu hóa “thời gian phải chờ”. Ví dụ: thời gian phảichờ khi thực hiện update repo: apt-get update

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 5 / 9

Page 6: DockerDay2015: Introduction to Dockerfile

Experience: Thin vs Flat

Đóng gói phần mềm: có 2 phong cách.

• Thin (like micro design): one process per container.

• Flat (like monolithic design): all-in-one, docker container like VM.

=> tùy trường hợp để sử dụng.

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 6 / 9

Page 7: DockerDay2015: Introduction to Dockerfile

Experience: Base dựa trên image nào?

Cân bằng giữa tính tiện dụng và tính nhỏ gọn.

• Tiện dụng: dùng ubuntu, có nhiều phần mềm trong repo. Khi runcontainer, có thể execute vào container và có sẵn các phần mềm đểhỗ trợ việc xem thông tin, chỉnh sửa. Ví dụ: như vi editor.

• Nhỏ gọn: để có được tính nhỏ gọn, cần cắt giảm các gói phần mềmkhông bắt buộc, làm giảm tính tiện dụng.

ubuntu 14.04 6d4946999d4f 188.3 MBdebian wheezy 1265e16d0c28 84.98 MBalpine latest 31f630c65071 5.254 MB

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 7 / 9

Page 8: DockerDay2015: Introduction to Dockerfile

References

1 https://blog.docker.com/2015/04/docker-tutorial-6-dockerfile-part-1/

2 https://docs.docker.com/reference/builder/

3 https://docs.docker.com/articles/dockerfile_best-practices/

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 8 / 9

Page 9: DockerDay2015: Introduction to Dockerfile

Thank you!• http://www.meetup.com/Docker-Hanoi/

• Trần Hữu Cường: [email protected]

Trần Hữu Cường (OLBIUS Vietnam) Introduction to Dockerfile Hà Nội, 19/07/2015 9 / 9