5/21/2018

Ubuntu 16.04 LTS Version 설치 및 설정

1. Ubuntu 16.04 설치 

기존까지 Ubuntu 14.04 LTS 64bit 와 Ubuntu 12.04 LTS 64bit Version으로만 이용하다가 얼마전에 Ubuntu가 18.04 Release가 되었으며,
Ubuntu 16.04도 더이상은 최신 Version 이라고 할수 없을 것 같아 이를 설치해보고 현재 Ubuntu의 최신기능과 관련부분을 알아보도록 하자.

  https://www.ubuntu.com

  • 다양한 CPU지원 
Ubuntu가 Desktop 및 Server 와 IOT와 Cloud 로 분류가 되어서 나오고 있으며, x86을 벗어난 ARM64 까지 지원을 하고 있다.
집에 있는 Odroid 및 다른 EVM에서 여러번 봤지만 공식 홈페이지에서 보기는 이번이 처음이다.

  • Could 기능 및 OpenStack 지원 
Docker 기반으로 Container를 이용하여 쉽게 설치 지원이 가능하며, Kubernetes도 현재 지원이 되고 있는 상황이다
이미 Docker기능 및  Jenkins로 이전 Version에서 사용을 했지만, 공식사이트에서 보니 새롭다.

  https://www.ubuntu.com/containers


  • 설치문서 
  https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop?_ga=2.9632694.2071981096.1526908963-614826485.1523275796#8


1.1 Download Ubuntu Image

Virtual Box 기반으로 최소의 용량을 사용하기 위해서 Desktop Version으로 설치진행

  • Download Mirror Site 
  https://launchpad.net/ubuntu/+cdmirrors?_ga=2.206215952.2071981096.1526908963-614826485.1523275796
  http://mirror.kakao.com/ubuntu-releases/16.04/


  ubuntu-16.04.4-desktop-amd64.iso


1.2  Virtual Box 기본설정 

Virtual Box 설치 및 설정은 크게 변경된 것이 없음으로 아래와 같이 동일하게 구성을 하자
  1. 기본 Ubuntu VDI 30G 새로생성 
  2. 생성된 VDI를  용량최소화위해 동적할당 설정 
  3. 네트워크->브리지 어댑터 (어댑터에 브리지) 설정 
  4. 메모리 설정 변경 (본인의 램의 절반수준)
  5. 공유폴더 설정 (추후 설정)
  6. 저장소 설정 IDE 에 Ubuntu Image ISO 추가 
  https://ahyuo.blogspot.kr/search/label/Virtual%20Box


2. Ubuntu 16.04 LTS 기본설치 

  • 기존과 동일하게 설정 
  1. 설치->언어 : 한국어 설정 
  2. 설치->키보드 배치 : 한국어- 한국어 (101/104키호환)
  3. 설치->이름/컴퓨터이름 설정 (계정설정)

설치후 자동으로 IDE의 Ubuntu Image ISO가 제거됨
이전과 다르게 다른 VDI를 자동으로 잡으며 이를 바로 볼수 있다.

  • 기본설치 후 Virtual Box 확장패키지 설치 
  1. 좌측의 맨위 검색에서 Terminal 검색 및 런처에 고정 
  2. 장치->게스트 확장 CD 이미지 삽입 
  3. 실행 및 암호입력 
  4. Ubuntu Reset 

  • Virtual Box Machine 부분 설정 
  1. 일반->고급  클립보드:  양방향 설정 
  2. 일반->고급 드래그 앤 드롭: 양방향 설정 

3. Ubuntu 기본환경 설정 

우선 좌측 상위 맨위 검색버튼을 눌러 Terminal을 검색하여 실행한 후 이를 런처에 고정하자.

  • SSH Server 설정
$ sudo apt-get install openssh-server
$ sudo apt-get install vim     // vim 방향키 문제가 있어 다시 설치 


  • SSH Client - Xshell4 에러 (Xshell6 변경)
등록 정보 ->SSH -> 보안 -> 암호화 설정  확인해보면 해결된다고 하는데, 설정을 봐도 크게 이상이 없다
현재 Xshell4의 보안 알고리즘이 지원을 못한다 그래서 Xshell 6으로 변경 후 아래의 증상은 해결되었다.


  https://www.netsarang.co.kr/forum/xshell/2155/%EC%95%94%ED%98%B8_%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98_%EC%97%90%EB%9F%AC


  • Samba 설정 
$ sudo apt-get install samba  

$ sudo smbpasswd -a jhlee 
New SMB password:
Retype new SMB password:
Added user jhlee.

$ sudo vi /etc/samba/smb.conf   
.......
#======================= Share Definitions =======================

[homes]
comment = Home Directories
valid users = %S
read only = no
;read/write 가능하게 설정하고 싶다면 아래와 같이 설정 
;read only = no or writable = yes 
;read only 만 할 경우는 yes로 설정 
browseable = Yes
;create mask = 0755
;directory mask = 0755

$ sudo /etc/init.d/smbd restart // Samba Server Restart!

본인이 편하다고 생각이 들면 윈도우 탐색기에서 네트워크 드라이브 연결 (옵션)


  • GIT 설치
$ sudo apt-get install git 


  • 공유폴더 설정
아래와 같이 권한을 설정을 한 후

$ sudo vi /etc/group 
    .....
    .....
    vboxsf:x:1001:jhlee  --- > vboxsf 찾은 다음  자신의 ID  추가 

Virtual Box->설정->공유폴더 설정


아래와 같이 공유 확인 가능

$ ls /media/sf_SHARED/
....


3.1 Virtual Box의 VDI 추가 및 확인  

  • 기존 사용하던 VDI 및 새로생성할 VDI 확인  
  1. Virtual Box에서 저장소->SATA에 기존에 사용중 VDI or 새로생성한 VDI를 추가 
  2. Ubuntu 로 부팅 후  각 개별 command로 확인 
  3. df -h 용량 확인 
  4. cat /proc/partitions  // VDI 정보확인 
  5. sudo fdisk -l  // VDI 정보 확인 


$ df -h    // 사용되는 Filesystem 용량을 간단히 확인 
Filesystem      Size  Used Avail Use% Mounted on
udev            971M     0  971M   0% /dev
tmpfs           200M  3.9M  196M   2% /run
/dev/sda1        28G  4.4G   22G  17% /
tmpfs           997M  212K  997M   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           997M     0  997M   0% /sys/fs/cgroup
SHARED          267G  169G   99G  64% /media/sf_SHARED
tmpfs           200M   40K  200M   1% /run/user/1000

$ cat /proc/partitions       // 새로 생성된 VDI 및 기존 VDI를 추가 했기때문에 이를 확인 
major minor  #blocks  name

  11        0    1048575 sr0
  11        1    1048575 sr1
   8        0   31457280 sda    // Ubuntu VDI 
   8        1   29359104 sda1
   8        2          1 sda2
   8        5    2095104 sda5
   8       16   31457280 sdb     // 새로 생성한  VDI 2번째 , 새로 생성하여 Partition을 잡아야한다. 
   8       32   31457280 sdc     // 기존에 존재하던 VDI 3번째  
   8       33   31456256 sdc1
   8       48   31457280 sdd     // 기존에 존재하던 VDI 4번째  
   8       49   31456256 sdd1
$ lsblk 


  • 새로생성한 VDI  Partition 설정 및 FS Format
상위에서 새로 추가된 VDI 설정확인

 $ sudo fdisk /dev/sdb // 상위에서 확인한 새로 추가된 VDI 
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x9975df29.

Command (m for help): n     // Partion 추가 
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62914559, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-62914559, default 62914559): 

Created a new partition 1 of type 'Linux' and of size 30 GiB.

Command (m for help): p    // 추가된 Partion 확인 
Disk /dev/sdb: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9975df29

Device     Boot Start      End  Sectors Size Id Type
/dev/sdb1        2048 62914559 62912512  30G 83 Linux

Command (m for help): w  // 저장  
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

$ sudo mkfs.ext4 /dev/sdb1  // 새로 생성된 Partition 을 EXT4로 포맷 


3.2 추가된 VDI의 자동마운트 

UUID는 Partition을 생성을 한 후에 이 값을 얻을 수 있으므로,  다음과 같이 sdx1 x는 drive를 말하고 1은 Partition을 말한다.
만약 추가했지만, 잡히지 않는다면, 위의 fdisk에서 새로 잡도록하자.

$ ls -l /dev/disk/by-uuid/  
or 
$  sudo blkid
lrwxrwxrwx 1 root root 10  5월 23 21:06 35e74ae8-80c1-4832-bff6-674b4a93d6c2 -> ../../sdd1
lrwxrwxrwx 1 root root 10  5월 23 21:06 b771bdc7-e7f7-454b-a48a-df598833169d -> ../../sdc1
lrwxrwxrwx 1 root root 10  5월 23 21:06 ce6b9446-1e0f-4330-b7e9-923a06501ae9 -> ../../sda5
lrwxrwxrwx 1 root root 10  5월 23 21:06 ed70c2a9-0c95-4e4e-81d8-9bdf6adfe839 -> ../../sda1
lrwxrwxrwx 1 root root 10  5월 23 21:06 ff6cb88e-963c-4bf2-ab67-f24b9e7918b5 -> ../../sdb1

$ sudo vi /etc/fstab

UUID=ed70c2a9-0c95-4e4e-81d8-9bdf6adfe839 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=ce6b9446-1e0f-4330-b7e9-923a06501ae9 none            swap    sw              0       0

 
## 새로 mount할 곳 ,뒤에 옵션 현재는 동일하게 사용 중, errors=remount-ro 0       1 

##RaspberryPI                                                     
UUID=ff6cb88e-963c-4bf2-ab67-f24b9e7918b5 /home/jhlee/raspberrypi   ext4    errors=remount-ro     0       1 

- 저장후 재부팅 

$ sudo chown jhlee:jhlee -R raspberrypi 

이제 생성된 UUID기반으로 /etc/fstab에서 설정을 해주자.


  • 자세한 내용은 아래 참고 
  https://ahyuo.blogspot.kr/2013/12/virtual-box-ubuntu-1204.html

5/10/2018

Docker Command 사용법 정리

1. Docker Concept


Docker를 Container의 기술이라고 하며, 이 기술은 Virtualization과 아주 흡사하게 동작하는 기술이다.
이는 개발과 배포를 보다 손쉽게 해주는 실행해주는 기술로, 가상머신처럼 Image를 받아 실행을 해주는 기술이다.

Docker 기본환경설치
  https://ahyuo79.blogspot.com/2017/07/docker.html

Docker Redmine 설치
  https://ahyuo79.blogspot.com/2018/02/docker-redmine.html


1.1 Docker 의 containers 와 Image 개념


Dockerfile -> Image -> Container 

  • Container
쉽게 생각하면, Virtual Machine에서 Virtual HW에 해당하는 부분이지만, 좀 다르게, 추상화된 Package가 맞을 것 같다. 
Containers는 Image (App/Bin/Libs) 가 제대로 동작할 수 있도록하는 Image의 Instance 개념으로 Container를 생성한다.
그리고, 이 Image의 Instance를 Docker 기반으로 내부 App을 실행을 하고 외부와 차단하여 동작되어진다.
아래 그림 참조 

Virtual Machine과 다르게 Hypervisior / Guest OS를 사용하지 않고 Docker만을 이용하여,  외부(Container 끼리 혹은 Host)와 차단을 하여 동작을 한다.

물론 Container 외부와 통신하고 공유하는 방법도 존재하므로 설정에 따라 이 부분은 다르게 동작한다.
Container가 생성된 후에는 Container 내부에서는 독립적으로 데이타 저장도 가능하며 확장도 가능하지만, 종료가 될 때 Container도 삭제하도록 구성도 가능하다
일반적으로 Docker에서 Container를 생성하는 방법은 run 명령create를 이용하여 생성할 수 있다.


  • Images
Image는 실행될 수 있는 Binary Package를 말하며, 이는 Application을 구동시키기 위해서 사용되어지는 
Runtime Code , Libraries , 환경변수 및 설정파일들을 포함하고 있다.
처음 Dockerfile에 의해서 상위구성들을 Image로 만든다. 그리고,
이 Image는 Container를 처음 구성할때 같이 포함되어 실행될때 필요하다.

Container 와 image의 차이라면, Container는 Docker에서 실행을 하면서 필요한 Data 저장 및 변화된 환경 및 상태보관이 가능하다.
이외 에도 있을 거지만, 거기까지는 나도 잘 모르겠다. 


  • Container Orchestration
Container 하나만을 실행하면 괜찮겠지만, 문제는 여러개를 사용할 경우 이것을 조율해주고 관리해주는 Tool 이 필요하게된다.
이를 Container Orchestration 이라고 하며, 현재 유명한 것이 Docker Swarm Kubernetes 인 것 같으며,  아직 사용법은 모르겠다.

요즘 이슈가 되는게, Kubernetes로 Server기반으로 많이 사용되는 것 같으며, 내가 사용을 할 기회는 거의 없을 것 같다. 


1.2 Docker 와 Virtual Machine 비교 

간단하게 차이를 보면 Hypervisior, 즉 가상의 CPU / HW환경구성을 비롯하여 Guest OS를 볼수 있겠다.


  • Docker vs Virtual Machine 비교

Docker
Image 기반으로 Container라는 공간을 만들어 APP/Bins/Libs를 관리하며 기본으로 외부와 격리되어 동작된다.

Virtual MachineHypervisior라는 가상의 CPU구성 및 HW 환경구성 기반위에 별도의 GuestOS가 있고, 그 위에 App 관련된 구성이 돌아간다. (다른 CPU구성과 HW구성도 가능)


위에서 보았듯이 Docker의 Container 기술은 가볍고 빠르게 동작이 가능하지만, Host OS Kernel 과 공유하는 부분이 존재하므로, HW 자원의 고갈문제가 발생한다.
예를들면, 여러개의 Contianer가 동작 중이라면, 각각의 Container 마다 Host OS의 HW자원을 사용하려고 할텐데, 이 부분을 별도로 관리가 필요해서 오케스트라션이 필요한 것 이다.
이를 흔히 로드밸랜스라고 한다. 


  • Docker 세부내용은 아래 사이트 참조
  https://docs.docker.com/get-started/#docker-concepts
  https://docs.docker.com/get-started/part2/

  • Virtual Machine 과 Docker 비교
  https://www.aquasec.com/wiki/display/containers/Docker+Containers+vs.+Virtual+Machines
  https://blog.docker.com/2016/04/containers-and-vms-together/
  https://blog.thousandeyes.com/thousandeyes-docker-enterprise-agents/
  https://www.aquasec.com/wiki/display/containers/Docker+Architecture
  https://docs.docker.com/engine/docker-overview/
  https://www.phpflow.com/misc/devops/part-1-getting-started-docker-tutorial/
  https://success.docker.com/article/networking
  https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
  http://www.leafcats.com/146


1.3 Docker 개념의 관련자료 링크모음 


  • Docker Overview 및 개념확인


  • LXC vs Docker
Docker  Container 기술과 유사한 기술인 LXC (Linux Container) 있지만 이는 좀 다르게 동작하는 것 같다.
  http://www.opennaru.com/openshift/docker/what-is-the-difference-between-docker-lxd-and-lxc/
  https://linuxcontainers.org/lxc/introduction/
  https://robin.io/blog/containers-deep-dive-lxc-vs-docker-comparison/

  • Docker 관련내용 
  https://www.slideshare.net/pyrasis/docker-docker-38286477
  https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
  https://subicura.com/2017/01/19/docker-guide-for-beginners-2.html
  https://www.clien.net/service/board/lecture/7042127
  http://blog.nacyot.com/articles/2014-01-27-easy-deploy-with-docker/



  • Docker VirtualBox
Docker에서 virtual box를 이용하여 사용하는데, virtual box 내부에서 docker를 사용하는지는 추후에 알아보자
  https://docs.docker.com/machine/drivers/virtualbox/


  • Docker EE의 구성
  https://www.docker.com/products/docker-enterprise


  • Container  Orchestration
컨테이너 오케스라이션 두 개를 각각 자세히 알아보자.
추후에 세부적으로 사용할 일이 있겠지?

Docker SWARM
  https://docs.docker.com/swarm/overview/#understand-swarm-cluster-creation

Kubernetes
  https://kubernetes.io/
  https://www.redhat.com/ko/topics/containers/what-is-kubernetes
  https://www.popit.kr/kubernetes-introduction/
  https://www.slideshare.net/ienvyou/docker-on-kubernetes-v1
  https://cloud.google.com/kubernetes-engine/

Jenkins(DevOps) 와 Kubernets 연결 (Google의 활용)
  https://cloud.google.com/solutions/jenkins-on-kubernetes-engine-tutorial


2. Docker 의 기본설치 

Docker는 최근부터 두가지 Edition으로 제공하고 있으며, CE는 아래의 글을 읽어 보면 알겠지만, 
무료이고 개발용/실험용으로 무료로 제공해주고 있다.
EE는 기업용으로 좀 더 나은 기능을 제공해주고 있다.
현재 내가 본 Docker Version 17.09이며 지속적으로 새로운 기능과 다른 기능을 추가해주고 있는 것 같다.
  1. Docker CE (Community Edition)
  2. Docker EE (Enterprise Edition)

기업용(EE)는 나는 사용할 기회가 없으므로, 추후 기회가 생긴다면 그때 알아보자.
그리고 현재 아래의 사이트에서 다른 점 및 CE의  업데이트 주기를 알고 넘어 가야겠다.

  • Docker 설치 전에 확인사항 
Docker Version과 CE/EE 의 차이를 알아두자
  https://docs.docker.com/v17.09/engine/installation/
  https://docs.docker.com/install/

  • Docker  설치 방법
설치방법은 어렵지 않으니 아래의 사이트에서 확인
  https://docs.docker.com/install/linux/docker-ce/ubuntu/
  https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository
  http://dololak.tistory.com/354?category=644234
  http://pyrasis.com/Docker/Docker-HOWTO
  https://docs.docker.com/glossary/


2.1  Docker 의 명령어 사용법 

간단하게 아래의 사이트에서 Docker 의 명령어들을 익혀보자

간단 Manual
  https://gist.github.com/nacyot/8366310

Docker Command의 Option 확인
  https://docs.docker.com/engine/reference/commandline/start/#options

  • Docker-CE의 Command 확인 

$ docker --help
Usage: docker [OPTIONS] COMMAND [arg...]

A self-sufficient runtime for linux containers.

Options:
  --api-cors-header=                   Set CORS headers in the remote API
  -b, --bridge=                        Attach containers to a network bridge
  --bip=                               Specify network bridge IP
  -D, --debug=false                    Enable debug mode
  -d, --daemon=false                   Enable daemon mode
  --default-ulimit=[]                  Set default ulimits for containers
  --dns=[]                             DNS server to use
  --dns-search=[]                      DNS search domains to use
  -e, --exec-driver=native             Exec driver to use
  --fixed-cidr=                        IPv4 subnet for fixed IPs
  --fixed-cidr-v6=                     IPv6 subnet for fixed IPs
  -G, --group=docker                   Group for the unix socket
  -g, --graph=/var/lib/docker          Root of the Docker runtime
  -H, --host=[]                        Daemon socket(s) to connect to
  -h, --help=false                     Print usage
  --icc=true                           Enable inter-container communication
  --insecure-registry=[]               Enable insecure registry communication
  --ip=0.0.0.0                         Default IP when binding container ports
  --ip-forward=true                    Enable net.ipv4.ip_forward
  --ip-masq=true                       Enable IP masquerading
  --iptables=true                      Enable addition of iptables rules
  --ipv6=false                         Enable IPv6 networking
  -l, --log-level=info                 Set the logging level
  --label=[]                           Set key=value labels to the daemon
  --log-driver=json-file               Containers logging driver
  --mtu=0                              Set the containers network MTU
  -p, --pidfile=/var/run/docker.pid    Path to use for daemon PID file
  --registry-mirror=[]                 Preferred Docker registry mirror
  -s, --storage-driver=                Storage driver to use
  --selinux-enabled=false              Enable selinux support
  --storage-opt=[]                     Set storage driver options
  --tls=false                          Use TLS; implied by --tlsverify
  --tlscacert=~/.docker/ca.pem         Trust certs signed only by this CA
  --tlscert=~/.docker/cert.pem         Path to TLS certificate file
  --tlskey=~/.docker/key.pem           Path to TLS key file
  --tlsverify=false                    Use TLS and verify the remote
  -v, --version=false                  Print version information and quit

Commands:
    attach    Attach to a running container       // 동작 중인 Container에 접속가능 (exec로도 가능)
    build     Build an image from a Dockerfile
    commit    Create a new image from a container's changes
    cp        Copy files/folders from a container's filesystem to the host path // Container에서 생성된 정보를 가져올때 사용 
    create    Create a new container
    diff      Inspect changes on a container's filesystem
    events    Get real time events from the server
    exec      Run a command in a running container // 동작 중인 Container에 명령어 실행 (/bin/bash 를 이용하여 접속가능) 
    export    Stream the contents of a container as a tar archive
    history   Show the history of an image
    images    List images   // 현재 존재하는 Image List들을 확인 
    import    Create a new filesystem image from the contents of a tarball
    info      Display system-wide information
    inspect   Return low-level information on a container or image
    kill      Kill a running container
    load      Load an image from a tar archive
    login     Register or log in to a Docker registry server
    logout    Log out from a Docker registry server
    logs      Fetch the logs of a container
    port      Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
    pause     Pause all processes within a container
    ps        List containers   // 동작 중인 containers의 list 보여주며, name도 확인가능 
    pull      Pull an image or a repository from a Docker registry server // Image를 가져올때 사용 
    push      Push an image or a repository to a Docker registry server
    rename    Rename an existing container
    restart   Restart a running container
    rm        Remove one or more containers  // container 제거 
    rmi       Remove one or more images      // image 제거 
    run       Run a command in a new container // 처음 Container를 생성할 때 사용하는 명령
    save      Save an image to a tar archive
    search    Search for an image on the Docker Hub // Docker Hub에서 Image 검색 
    start     Start a stopped container
    stats     Display a stream of a containers' resource usage statistics  // Container의 HW 자원 확인 
    stop      Stop a running container
    tag       Tag an image into a repository
    top       Lookup the running processes of a container
    unpause   Unpause a paused container
    version   Show the Docker version information
    wait      Block until a container stops, then print its exit code



Docker 안쓰는 Image / Container 삭제
  http://www.kwangsiklee.com/2017/07/docker-%EC%95%88%EC%93%B0%EB%8A%94-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EC%A0%95%EB%A6%AC%ED%95%98%EA%B8%B0/
  https://www.popit.kr/%ED%95%B4%EA%B2%B0%EB%B0%A9%EC%95%88-docker%EB%A5%BC-%EC%9A%B4%EC%98%81%ED%95%98%EB%8B%A4-%EC%9A%A9%EB%9F%89%EC%9D%B4-%EA%BD%89%EC%B0%BC%EC%9D%84%EB%95%8C/


$ cat /lib/systemd/system/docker.service  //docker server부분 설정 

$ sudo du -sh /var/lib/docker   // docker image 및 저장위치 인 것 같음 

$ ls /etc/docker/      // 각 설정, 현재 모름 
daemon.json  key.json    



  • MYSQL  세부저장 
  http://jibak.tistory.com/13?category=625389
  http://jibak.tistory.com/7


  • Docker 저장소 변경 
  https://kiros33.blogspot.kr/2015/05/docker.html


2.3 Docker Container의  Backup 과  Restore 방법 

Docker 기반으로 개발할 경우, Container의 Backup 과 Restore는 중요하며, 이부분은 별도로 테스트를 해서 검증을 해보며 써야 할 것  같다.
대부분 Container에서 부족한 부분은 본인 Terminal을 이용해서 설치도 가능하며, 이를 Backup 해서 본인만의 image를 새로 구축해도 될 것 같다. (배포도 가능)

commit 후에 save를 할때 tar 묶는 이유를 보면, docker가 하나의 image로 저장이 되지 않아서 인것 같다.
/var/lib/docker 으로 분산되어 존재하는 것 같은데,  추후에 자세히 알면 이 부분은 다시 분석

아래사이트 참고
  http://home.zany.kr:9003/board/bView.asp?bCode=13&aCode=14131&cBlock=0&cPageNo=1&sType=0&sString=
  https://digndig.kr/docker/709/


2.4 Docker File 만들기 

docker build를 이용하여 dokerfile을 쉽게 image로 만들 수 있으며, 대 부분은 기존의 Base Image가 존재하는 상태에서
본인 필요한 Package를 추가하는 형태로 새롭게 만들어나가는 구조로 사용하는 것 같다.

결과적으로 보면 Docker Container Backup 과 기존의 Image를 이용하여 Docker File을 새롭게 만들어서 구축하는 방법은 동일하다.
배포도 가능하며, 이 부분은 추후에 다시 동작을 해보도록 하자.

  • Docker File 만들기
DOCKERFILE , File을 만든 후 아래의 Link의 Command로 쉽게 구성할 수 있다. 
  https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
  https://medium.com/@NovaWoo/docker-%EC%99%80-jenkins-%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%9C-%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-ci-1-9510178a525f


3. Simple Linux File System Download

우연히 발견한 사이트이지만,  가끔 Simple한 File system 구성이 필요할때가 있는데, 마침 찾았다.
예전처름 처음부터 package를 일일히 설치해가며 Filesystem을 구축을 해 만들필요는 없는것 같다.


  https://alpinelinux.org/downloads/