WHEREIS



# coreos 설치 과정

http://ossian.tistory.com/11



# coreos 이미지 파일

https://stable.release.core-os.net/amd64-usr/current/


> 설치 과정에서 외부 통신이 필요하나, 내부망에서 하기 위해

  해당 이미지 파일 등, Digests, asc 파일 등을 내부 웹서버에 넣어논다

  -b 옵션으로 $DEFAULT_URL 변경이 가능



# managment container enable


gutes os 에서 아래와 같이 실행(모니터링 에이전트?)

/media/configdrive/agent/xe-daemon


xenserver 에서 아래와 같이 실행(ssh trust key 설치)

xscontainer-prepare-vm -v <vm-uuid> -u <ssh사용자>



# docker 이미지 만들기

febootstrap -u http://192.168.150.43/CentOS/6/updates/x86_64/ centos6.8 centos6 http://192.168.150.43/CentOS/6/os/x86_64/

> https://hoguinside.blogspot.com/2018/04/docker-2-febootstrap.html



# docker 컨테이너 -> 이미지로 만들기

docker commit cc37b0e8c882  cent6-last

 


# docker 이미지 저장경로

 /var/lib/docker/



# docker 이미지 파일로 저장

docker save -o centos6-last.tar cent6-last



# 웹에서 이미지 받아서 저장

docker import  http://192.168.230.230/centos6-last.tar centos6-20181228




# 컨테이너 용량 증설


docker ps -a

ls -la /dev/mapper/


[root@xlogrep1 ~]# dmsetup table docker-8:2-6171191-cc37b0e8c882f6664d6a89d0f6724f1bbc5ea555bf5f7f2ce61b1a81e8f02cee


0 20971520 thin 253:0 467

# 20Gbyte


[root@xlogrep1 ~]# echo 0 41943040 thin 253:0 467 | dmsetup load docker-8:2-6171191-cc37b0e8c882f6664d6a89d0f6724f1bbc5ea555bf5f7f2ce61b1a81e8f02cee

[root@xlogrep1 ~]# dmsetup resume docker-8:2-6171191-cc37b0e8c882f6664d6a89d0f6724f1bbc5ea555bf5f7f2ce61b1a81e8f02cee

[root@xlogrep1 ~]# resize2fs /dev/mapper/docker-8:2-6171191-cc37b0e8c882f6664d6a89d0f6724f1bbc5ea555bf5f7f2ce61b1a81e8f02cee



# docker 컨테이너 만들기


docker run -p 192.168.230.232:80:80 -p 192.168.230.232:2022:22 -i -t  --name web2 cent6  /bin/bash

docker run -p 192.168.230.231:80:80 -p 192.168.230.231:2022:22 -i -t  --name web1 cent6  /bin/bash





# docker 포트 nat 정보 수정

/var/lib/docker/containers/[hash_of_the_container]/hostconfig.json


You can determine the [hash_of_the_container] via the docker inspect <container_name> command and the value of the "Id" field is the hash.


1) stop the container 

2) change the file

3) restart your docker engine (to flush/clear config caches)

4) start the container



docker 재시작을 필요로 하는데, 다른 방법이 있는지 확인 필요.



# docker 네트워크 생성

docker network create -d macvlan --subnet=192.168.110.0/24 --gateway=192.168.110.1 -o parent=eth0 net_dev



# dcoker 고정 IP 할당 / 리소스 제한 / 호스트명 할당 등

 docker run -it --net net_dev --ip 192.168.110.193 centos6:20181231 /bin/bash

docker run -it --net net_dev --ip 192.168.110.193 --hostname xpaydev-ap01 --name xpaydev-ap01 centos:centos6 /bin/bash

 docker run -it --net net_dev --ip 192.168.110.193 --cpus="0.2" --memory=4096m --hostname xpaydev-ap01 --name xpaydev-ap01 centos6:20190108-1 /bin/bash



# coreos 디스크 추가


vi /etc/systemd/system/data.mount


파일명의 <마운트경로>.mount 마운트경로와 Where 의 경로명이 동일해야함

ex) /mnt/data -> mnt-data.mount


[Unit]

Description=Docker data storage


[Mount]

#What=UUID=40546838-9c9b-4604-9f5d-d7d7692d0c6f

What=/dev/xvdc1

Where=/data

Type=xfs

#Options=defaults,auto,noatime,noexec 0 0

Options=defaults,pquota


[Install]

WantedBy=multi-user.target




# coreos docker 데이터 경로 변경


systemctl stop docker



cat /run/systemd/system/docker.service  /etc/systemd/system/docker.service



FROM:

ExecStart=/usr/bin/docker daemon -H fd://

TO:

ExecStart=/usr/bin/docker daemon -g /new/path/docker -H fd://



기존 경로의 파일(/var/lib/docker/*)을 옮김


systemctl daemon-reload


systemctl start docker




초기화?? ####################################

coreos2 data # docker system prune -a

WARNING! This will remove:

        - all stopped containers

        - all networks not used by at least one container

        - all images without at least one container associated to them

        - all build cache




# 기본 스토리지 60 G 할당, CPU 2할만 사용, 메모리 제한 등

 docker run -it --storage-opt size=60G --net net_dev --ip 192.168.110.193 --cpus="0.2" --memory=4096m --hostname xpaydev-ap01 --name xpaydev-ap01 centos6:20190108-1 /bin/bash



# macvlan 과 ipvlan 의 장단점

https://hicu.be/macvlan-vs-ipvlan



# 컨테이너 호스트명 변경 // 컨테이너 생성 후 변경이 가능한지 테스트 필요

Some discussions here: https://github.com/docker/docker/issues/8902



What I got from above discussion is



add SYS_ADMIN cap when run the container: https://github.com/docker/docker/issues/8902#issuecomment-218911749


use nsenter https://github.com/docker/docker/issues/8902#issuecomment-241129543

이 글을 공유합시다

facebook twitter kakaoTalk kakaostory naver band
loading