Skip to content

Instantly share code, notes, and snippets.

@anarcher
Last active August 29, 2015 14:14
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 anarcher/150b303e4abdf1af09c4 to your computer and use it in GitHub Desktop.
Save anarcher/150b303e4abdf1af09c4 to your computer and use it in GitHub Desktop.
Docker mini-containers project 소개

[[Docker]] mini-containers project 소개

mini-containers?

Minimal development containers

mini/base

A minimal, busybox-like container based on [[Alpine Linux]], that contains apk package manager to ease installation of extra packages and help you build smaller development containers.

작은 크기의 배포판. 패캐징 시스템(도) 있다.

Alphine Linux?

Alpine Linux is built around musl libc and busybox. This makes it smaller and more resource efficient than traditional GNU/Linux distributions.

잘 모르지만 glibc랑 다르다.(...) http://www.etalabs.net/compare_libcs.html

하지만... https://github.com/progrium/busybox

Notice: This image will probably soon be deprecated in favor of our even smaller Alpine Linux based image. Alpine is a minimal Linux distro designed with containers in mind, based on Busybox, with a real, modern package system.

Does size matter?

하지만 무언가 설치하기 시작하면... (...)

/ # apk-install git
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
(1/3) Installing expat (2.1.0-r1)
(2/3) Installing pcre (8.36-r0)
(3/3) Installing git (2.2.2-r0)
Executing busybox-1.23.0-r4.trigger
OK: 22 MiB in 28 packages

/ # apk-install vim
fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
(1/3) Installing ncurses-terminfo-base (5.9-r3)
(2/3) Installing ncurses-libs (5.9-r3)
(3/3) Installing vim (7.4-r3)
Executing busybox-1.23.0-r4.trigger
OK: 46 MiB in 31 packages

Usage

FROM mini/base
RUN apk-install <pakckagename>

CMD ["/bin/sh"]

golang 컨테이너 이미지 만들기

https://github.com/anarcher/mini-golang (https://registry.hub.docker.com/u/anarcher/mini-golang/)

Dockerfile:

FROM anarcher/mini-golang:1.3-onbuild

Build:

$docker build -t gotest .
Sending build context to Docker daemon 1.972 MB
Sending build context to Docker daemon
Step 0 : FROM mini-golang:1.3-onbuild
# Executing 3 build triggers
Trigger 0, COPY . /go/src/app
Step 0 : COPY . /go/src/app
---> Using cache
Trigger 1, RUN go-wrapper download	
Step 0 : RUN go-wrapper download
---> Using cache
Trigger 2, RUN go-wrapper install
Step 0 : RUN go-wrapper install
---> Using cache
---> d502061d9b74
Successfully built d502061d9b74

Run:

$docker run gotest
+ exec app
Hello world

문제점들

  • glibc기반으로 빌드된 golang binary을 쓸수 없다. (golang 1.4.1쓰고 싶은데 아직 apk으로 없다..)
  • 컴파일도 패치가 필요하다. (...) http://git.alpinelinux.org/cgit/aports/tree/main/go
  • golang 릴리즈 파일은 작지 않다.. -ㅁ-;; (압축 풀면 거의 240M)
  • 하지만, golang은 빌드하면 외부 의존성이 없는 실행파일이 나와서 python이나 java처럼 설치할 필요없기도 한데... (from scratch)
    • 하지만 많은 golang project가 go tool을 포함해서 docker container을 만든다.
      • 실시간 디버깅때문에? (...) CI에서 빌드하기 위해서.
        • Minimal development containers

TODO

결론

  • 사이즈가 정말 문젠가... 공통으로 쓰는 베이스가 같으면 좀 커도.. (...)
  • TinyCore Linux나 Busybox에서 시작하는 건 어떨까?
  • Container을 위한 리눅스 배포판 프로젝트는 없을까?

내 머릿속엔 사이즈, 고랭, libc, 관심적(interested)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment