반응형
1. 테스트 : CentOS Base 이미지를 서비스 실행
## test3 으로 centos 생성
[root@docker1 ~]# docker service create --name test3 centos
x25funyde39kb7hvf67hmycfg
overall progress: 0 out of 1 tasks
1/1: ready [======================================> ]
verify: Detected task failure
^COperation continuing in background.
Use `docker service ps x25funyde39kb7hvf67hmycfg` to check progress.
## 아래와 같이 ready -> Ruunning -> shutdown 을 반복하며 서비스가 온전히 실행되지 않는다.
[root@docker1 ~]# docker service ps test3
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
lf9a3rx24zjb test3.1 centos:latest docker3 Ready Ready 28 seconds ago
j0x5mdv663ok \_ test3.1 centos:latest docker3 Shutdown Complete 28 seconds ago
wfjstj41k3il \_ test3.1 centos:latest docker3 Shutdown Complete 34 seconds ago
vq5hejwtpwj7 \_ test3.1 centos:latest docker3 Shutdown Complete 40 seconds ago
gs9ggn1opql4 \_ test3.1 centos:latest docker3 Shutdown Complete 45 seconds ago
## 로그
## task delete가 계속 발생
[root@docker3 ~]# journalctl -u docker
Jul 30 06:09:32 docker3 dockerd[2087]: time="2020-07-30T06:09:32.036498578+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:09:37 docker3 dockerd[2087]: time="2020-07-30T06:09:37.750295973+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:09:43 docker3 dockerd[2087]: time="2020-07-30T06:09:43.387332732+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:09:48 docker3 dockerd[2087]: time="2020-07-30T06:09:48.997257235+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:09:54 docker3 dockerd[2087]: time="2020-07-30T06:09:54.744797531+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:00 docker3 dockerd[2087]: time="2020-07-30T06:10:00.475247495+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:06 docker3 dockerd[2087]: time="2020-07-30T06:10:06.216774515+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:11 docker3 dockerd[2087]: time="2020-07-30T06:10:11.963073108+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:17 docker3 dockerd[2087]: time="2020-07-30T06:10:17.515336984+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:22 docker3 dockerd[2087]: time="2020-07-30T06:10:22.162825145+09:00" level=info msg="NetworkDB stats docker3(34659d685dc3) - netID:5qmb0lj05xk7gihdzyn70n2sv leaving:false netPeers:3 entries:6 Queue qLen:0 netMsg/s:0"
Jul 30 06:10:23 docker3 dockerd[2087]: time="2020-07-30T06:10:23.207593895+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:28 docker3 dockerd[2087]: time="2020-07-30T06:10:28.810676712+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:34 docker3 dockerd[2087]: time="2020-07-30T06:10:34.454693363+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:40 docker3 dockerd[2087]: time="2020-07-30T06:10:40.109851203+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:45 docker3 dockerd[2087]: time="2020-07-30T06:10:45.680661933+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:51 docker3 dockerd[2087]: time="2020-07-30T06:10:51.208602088+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:10:56 docker3 dockerd[2087]: time="2020-07-30T06:10:56.903072221+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:11:02 docker3 dockerd[2087]: time="2020-07-30T06:11:02.435797949+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:11:08 docker3 dockerd[2087]: time="2020-07-30T06:11:08.277223282+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:11:13 docker3 dockerd[2087]: time="2020-07-30T06:11:13.847374194+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:11:19 docker3 dockerd[2087]: time="2020-07-30T06:11:19.648902081+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
Jul 30 06:11:25 docker3 dockerd[2087]: time="2020-07-30T06:11:25.294014049+09:00" level=info msg="ignoring event" module=libcontainerd namespace=moby topic=/tasks/delete type="*events.TaskDelete"
## Centos가 Running으로 상태가 변경되며 바로 컨테이너의 프로세스가 종료되고 삭제 -> replication이 일어나는 현상
## centos같은OS의 경우 nginx 같은 어플리케이션과 다르게 실행 하고 있는 것이 없으므로 container가 생성되자 마자 죽는다.
## 따라서 서비스를 생성 할때 sleep cmd를 다음과 같이 추가 한 후 실행한다.
[root@docker1 ~]# docker service rm x25funyde39k
x25funyde39k
[root@docker1 ~]# docker service create --name test3 centos sleep infinity
fhhjqm7oyytzu5bgpej0ucpr5
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
## 정상적으로 올라옴
[root@docker1 ~]# docker service ps test3
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
hiwej5tf3ivr test3.1 centos:latest docker3 Running Running 39 seconds ago
반응형
'Micro Service Architecture > Docker' 카테고리의 다른 글
16. [docker] Portainer 설치 (0) | 2021.03.16 |
---|---|
15. [docker] Container Health Check (0) | 2021.03.16 |
13. [docker] 특정 node에 서비스 task 할당 (0) | 2021.03.16 |
12. [docker] drain (0) | 2021.03.16 |
11. [docker] docker 명령어 모음 (0) | 2021.03.16 |